-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenCV4 instead of opencv3 #272
Comments
I too am facing this, is there any specific workaround or solution for this please? I am on Jetson Tx2 and compiling opencv again would not be possible as i can do that only after flashing to free up space. Please help. |
I was able to successfully compile cv_bridge with opencv4 below are the rough notes of what i did:
|
It seems like there is work for adding opencv4 support on #259 . |
Yes but it's been open for half a year, it seems there isn't much maintenance on these repositories anymore. My advice: use that PR and compile all the necessary packages yourself. It's what we did. |
@vrabaud and/or @mjcarroll, |
@acxz I'm going to at least get it added for ROS2, since I'm maintaining that at the moment. I can't speak to the plans for ROS1 at the moment, but the change looks reasonable. |
Thank you for your comment! I hope it also gets added into ROS1: melodic. |
addresses ros-perception#272
@mjcarroll Curious any updates on this, at least for ROS2? |
Since this issue has openned for so long time, if there any progress on this, please close it. |
There hasn't been any progress, and ROS2 is basically a dead project. Plenty of systems have OpenCV 4 installed as the only version and yet ROS is still built against OpenCV 3.2. That means no modules depending on OpenCV can be built from source without building the entirety of ROS from source. Hilariously, on Ubuntu if you try to install OpenCV 3.2 dev libraries, it forces ROS to be removed. |
Sorry all, here is the plan moving forward: On the ROS1 side, @ahcorde is going to help out getting On the ROS2 side, I'm going to be getting Both of these releases are currently planned for May 23. |
Additionally, because @vrabaud has been missing for so long, it may be time for someone to claim maintainership on the ROS1 side by following the process here: http://wiki.ros.org/MaintenanceGuide#Claiming_Maintainership @seanyen I don't know if this is something that you and your team would be interested in. |
So I just started with the Jetson Nano and ros melodic and it comes with OpenCV 4.1.1. preinstalled. Should I remove it and install OpenCV 3.2. to ensure no compatibility issues with cv_bridge or other packages I have (currently having some compatibility issues when running catkin make because I tried to install the image_view package)? Will ROS be removed if I do that? Don't want to have to install a new OpenCV if possible @tkircher |
@jorgemia I recommend leaving the system OpenCV in place and building ROS from scratch. Skip the repositories completely and start from a clean install of Jetpack. One big problem though is that there are dozens and dozens of ROS modules that are included in the Ubuntu repo that are not present in the ROS source - rtabmap, for example. It isn't built in ROS Melodic by default, so you have to pull it down from github into your catkin workspace and build it manually. |
I decided to summarize what I did to get it working, here, for lack of a better place. We'll just start where the usual instructions start. We have to install the base dependencies, which work fine from repo:
Then we initialize rosdep:
Then create our catkin workspace and pull down what ROS thinks are the main packages:
Now we have to fix it to actually include the main packages, along with a few others:
Then we have to modify several files for building against OpenCV 4. First make the modifications specified in sreevan's comment above (or one of the various PRs). Then, In src/image_pipeline/image_publisher/CMakeLists.txt Change the OpenCV section from:
to:
In src/image_pipeline/image_publisher/src/nodelet/image_publisher_nodelet.cpp change CV_LOAD_IMAGE_COLOR to cv::IMREAD_COLOR In src/gazebo_ros_pkgs/gazebo_plugins/src/gazebo_ros_prosilica.cpp Change
to
Then we start the build:
This works for me, as they say. ;) |
Is OpenCV4 or vision_opencv preinstalled into ROS Noetic or do I need to install OpenCV separately? |
@AeroWRX Please don't ask the same question two times. Ask this kind of questions here https://answers.ros.org/questions/ |
@AeroWRX To answer the question, it depends. When you install vision_opencv, it pulls in opencv from your package manager. This has some advantages, since it means we can guarantee a working install on a particular release of Ubuntu (or whatever), provided you use the matching supported ROS version, but also it's a pain because the version of OpenCV in the package repository has been lagging for a long time (at 3.2). Ubuntu focal now packages OpenCV 4.2: https://packages.ubuntu.com/focal/libopencv-core-dev so things ought to improve. So provided you're also installing ROS on the latest version of Ubuntu, you should be OK. If you try on an older release, like 18/19, you will get OpenCV 3.2 unless you install both OpenCV and vision_opencv manually. |
@sreevan Which one ? I'd like to build opencv4.2 with Ubuntu 16.04 and python 2.7 |
@Algabri it is the second one (~/catkin_ws/src/vision_opencv/cv_bridge$ CMakeLists.txt). You might also have troubles in image_transport_plugins, image_pipeline and gazebo_plugins packages of ros (assuming you need ros as you are compiling CV_bridge) and so you would need to recompile them too after the below changes:
|
First of all, thank you so much for your help @sreevan Additional to this modification, I did as following:
I downloaded this and put it in I didn't find
and
I changed twice, first time:
Also second time after made comment out for above lines: message(STATUS "opencv version ${OpenCV_VERSION}")
change CV_LOAD_IMAGE_COLOR to cv::IMREAD_COLOR Also, first time : cap_.set(cv::CAP_PROP_POS_FRAMES,0);
change in gazebo_plugins/src/gazebo_ros_prosilica.cpp I didn't implement it because I am running the code with real robot not gazebo, is it necessary?? As you know last step: I see this line six times:
Note: If lines order in the code as below, it runs with OpenCV 4.2
But if they as:
The output:
Without Thanks |
ROS Noetic ships with the latest versions of OpenCV (4.2.0), vision-opencv, cv_bridge. Yet cv_bridge.h (line 43) still #includes "opencv2/core/core.hpp" which throws up an error and apparently prevents building a package. Am I missing something (probably) or is this part of an awaited fix? |
|
Thanks for your tolerant response to an uninformed question... The misplaced question came up because I am getting "No such file or directory" for opencv2/core/core.hpp when trying to build a package via catkin_make. I assume this is something to do with some missing dependencies or some such on my part and will continue searching |
It may be that the dependency isn't fulfilled. Have you verified that the corresponding |
Yes, have just verified again - "libopencv-dev is already the newest version (4.2.0+dfsg-5)" |
addresses ros-perception#272
I'm using latest vision of opencv, opencv 4.0.1, is there any plan to update repo to this version?
If you guys don't have a plan, is there any way to modify code to using this version of opencv?
I have already modify src/vision_opencv/cv_bridge/CMakeLists.txt, change:
to
and output shows ROS find OPENCV:
But report error when 👍
rospack depends cv_bridge
The text was updated successfully, but these errors were encountered: