简体   繁体   English

为什么cv_bridge在ROS Melodic中使用OpenCV 3.2?

[英]Why cv_bridge uses OpenCV 3.2 in ROS Melodic?

I have OpenCV 3.4 installed in Ubuntu 18. I also have installed ROS Melodic according to the website instructions. 我已经在Ubuntu 18中安装了OpenCV 3.4。我还根据网站说明安装了ROS Melodic。 However, I keep on getting an error that libopencv_core.so.3.2 is required. 但是,我不断收到错误消息,要求提供libopencv_core.so.3.2。

I already set my CMakeLists files to point to OpenCV 3.4. 我已经将我的CMakeLists文件设置为指向OpenCV 3.4。 However, I found out that in the file: 但是,我在文件中发现:

/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake /ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake

there is the following line hardcoded in opencv3.2: 在opencv3.2中有以下行硬编码:

set(libraries "cv_bridge;/usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2.0;/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.3.2.0;/usr/lib/x86_64-linux-gnu/libopencv_imgcodecs.so.3.2.0").

I tried to change it to 3.4 but I can not rebuild it. 我试图将其更改为3.4,但无法重建它。

The error I am getting is: 我得到的错误是:

/opt/ros/melodic/lib/image_view/image_view: error while loading shared libraries: libopencv_core.so.3.2: cannot open shared object file: No such file or directory

Why is OpenCV 3.2 hardcoded in cv_bridge and how can I rebuild it with OpenCV 3.4? 为什么在cv_bridge中将OpenCV 3.2硬编码,如何使用OpenCV 3.4重建它?

Update: I eventually installed OpenCV 3.2 and it worked properly. 更新:我最终安装了OpenCV 3.2,它可以正常工作。

Because opencv development speed is much faster than ROS individual module. 因为opencv的开发速度比ROS单个模块快得多。 And a lot of ROS modules went depreciated after someone left the job. 有人离职后,许多ROS模块就贬值了。

But that's by no means the end of the day( maybe end of the day for noobs). 但这绝不是一天的结束(对于菜鸟来说可能不是一天的结束)。 You can build it directly with any version of opencv core function(besides imshow kind of function) others should perform just fine. 您可以使用任何版本的opencv核心功能(除了imshow函数)直接构建,其他版本也可以正常运行。

The easiest way is to do is: in the console before executing catkin_make try to execute the following 最简单的方法是:在控制台中执行catkin_make之前,尝试执行以下命令

export CMAKE_PREFIX_PATH=/usr/local:$CMAKE_PREFIX_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

This should give preference to your custom OpenCV installation when doing the find_package(OpenCV 3.X.0 REQUIRED). 在执行find_package(需要OpenCV 3.X.0)时,这应该优先考虑自定义OpenCV安装。 Then compile and use the function of that version. 然后编译并使用该版本的功能。

Well if you do have to use 3.4 then I think you have to build ros version of opencv and image transport and cvbridge to the 3.4 if that's what you are targeting. 好吧,如果您确实必须使用3.4,那么我认为您必须将ros版本的opencv和图像传输以及cvbridge构建为3.4,如果这正是您的目标。

You can find the link here https://github.com/ros-gbp/opencv3-release The highest they provide seems to be 3.3 您可以在此处找到链接https://github.com/ros-gbp/opencv3-release他们提供的最高好像是3.3

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM