ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A

OpenCV 3.3

OpenCV 3.3 adds some C++11 support, as well as a DNN module.

These features could be quite useful for developers, and robotic applications.

ROS Kinetic and Lunar are both on OpenCV 3.2:

Are there any plans to upgrade the ROS OpenCV package to 3.3?


@rohbotics same issue!
I got 3.3.0 on rpi3.

More specific is the dependency for cv_bridge be compatible with 3.3.0
But I think OSRF friends are busy developing ROS2, I ever build from source cv_bridge with OpenCV3.2.0 to get (kinetic default), then pkg-config with 3.3.0 try to use other dnn functions, but got no luck.
The terminal freeze when i’m compiling the application code.

Ooops, sorry in Chinese.
Anyone got good idea? Let’s make it work together

@Vincent_Rabaud Is usually the one releasing OpenCV in ROS. I think that he would have the most context to tell us how much API breakage there is between these versions and if it makes more sense to release openCV3.3 in existing distros or to release it only in ROS Melodic.

Edit: opencv3 package version in all ROS distros can be found here:

I have been totally slacking on package maintenance but yes I will upgrade
it soon. We usually try to keep versions steady but maintaining OpenCV is
too big and just upgrading is easier. Plus, there is a package versioning
bug (in bloom ?) that requires a version bump to get OpenCV working on
Gentoo. Stay tuned.


Note that opencv 3.3 added initializer list constructors for cv::Mat and cv::Mat_. As a result, code using uniform initialization syntax may change meaning:

cv::Mat a{2, 2, CV_8UC1};

In opencv 3.2 that creates a 2 by 2 matrix with data type 8UC1. In opencv 3.3 it creates a cv::Mat with a single column containing 3 integers.

In the latest release (3.3.0) this even took over from the copy constructor because the initializer_list constructor was implemented as an constructor template for all std::initializer_list<T> without placing limits on T:

cv::Mat foo = cv::imread("foo.png");
cv::Mat copy{foo};

In opencv 3.2 this invokes the copy constructor. In opencv 3.3.0 this creates a 1x1 matrix containing some strange value. Templates that don’t know they’re dealing with a cv::Mat are especially prone to bugs because of this. A PR has been merged that makes sure the above code invokes the copy constructor again in opencv 3.3 (by restricting the initializer list constructor to arithmetic types), but it’s not in a release yet:

Personally I made sure that none of our code was accidentally using the std::initializer_list constructor by adding a static_assert(!std::is_same<T, T>::value, "") inside the constructor in the opencv header and then recompiling all our code. Not pretty, but it works.

1 Like

Wow, thanks for theses feeds! great insight

3.3.1 got out with your fix and I just released it for Kinetic and Lunar.

Enjoy !


Not that I am particularly religious or anything but: Hallelujah Brother!

When you are next in San Jose I owe you many beers!

Is anyone else having a problem with the switch from opencv3.2 to 3.3 in kinetic? Unfortunately many of the packages in kinetic were compiled against 3.2, but its no longer available in the ROS ubuntu PPA. So currently I’m stuck unless I recompile all ROS packages that link against opencv myself.

For example:

zac@zac-prodesk:~/mbot$ rosrun rqt_image_view rqt_image_view 
[ERROR] [1513885925.962331324]: Failed to load nodelet [rqt_image_view/ImageView_0] of type [rqt_image_view/ImageView]: Failed to load library /home/zac/mbot/devel/lib// Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = cannot open shared object file: No such file or directory)
zac@zac-prodesk:~/mbot$ sudo apt install ros-kinetic-opencv3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ros-kinetic-opencv3 is already the newest version (3.3.1-0xenial-20171106-101742-0800).
ros-kinetic-opencv3 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 58 not upgraded.
zac@zac-prodesk:~/mbot$ sudo apt install ros-kinetic-opencv3=3.2*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '3.2*' for 'ros-kinetic-opencv3' was not found

There is a known issue with opencv linking in the 3.3 release. It has been resolved and is tracked for the next OpenCV release targeted for tomorrow. We’re tracking it internally here with a few quick workarounds. I hope to have a new release out soon after OpenCV releases the version with the fix included.

Hi @Vincent_Rabaud, thanks for this helpful release. How much work would it be to upgrade it to opencv 3.4.1 (or newer)? The newest versions of opencv support importing pretrained graphs trained using Tensorflow in order to run forward inference and makes it possible without having to bother installing tensorflow and it’s dependencies. Here is an example

In light of the large number of issues upgrading OpenCV from 3.2 to 3.3, which was expected to not be an issue, we will not plan to update it again. As of Melodic we are planning to use the system installed version of opencv (with a few custom backports for older platforms) as the standard integration version. Discussion here: