ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ImportError: libopencv_core.so.4.2:cannot open shared object file no such file or directory

asked 2022-11-02 21:57:01 -0500

huhahaha gravatar image

updated 2022-11-02 22:03:12 -0500

Traceback (most recent call last):
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
cb(msg)
File "/home/user/vrx_ws/src/vrx/vrx_gazebo/nodes/cam_test.py", line 55, in camera_right_callback
cv_image2 = bridge_object.imgmsg_to_cv2(data,"bgr8")
File "/opt/ros/noetic/lib/python3/dist-packages/cv_bridge/core.py", line 163, in imgmsg_to_cv2
dtype, n_channels = self.encoding_to_dtype_with_channels(img_msg.encoding)
File "/opt/ros/noetic/lib/python3/dist-packages/cv_bridge/core.py", line 99, in encoding_to_dtype_with_channels
return self.cvtype2_to_dtype_with_channels(self.encoding_to_cvtype2(encoding))
File "/opt/ros/noetic/lib/python3/dist-packages/cv_bridge/core.py", line 91, in encoding_to_cvtype2
from cv_bridge.boost.cv_bridge_boost import getCvType
ImportError: libopencv_core.so.4.2: cannot open shared object file no such file or directory

I am using Ubuntu 20.04 noetic and opencv version is 4.4.0! Now, I tried importing the camera in the gazebo virtual environment that I made myself in the past with opencv, and I saw that ImportError: libopencv_core.so.4.2: was displayed. At first, to use yolo github, I kept installing and deleting other versions of opencv.

Now, I checked libopencv_core in the admin folder, and there are files related to libopencv_core 4.4. Is there any way to open it with 4.4 instead of lipopencv_core 4.2…???

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2022-11-03 06:48:45 -0500

Mike Scheutzow gravatar image

The default version of libopencv in ubuntu 20 is 4.2.0. Many ROS packages depend on this. If you want to use ROS, you should remove all other versions and re-install 4.2.0 from apt.

You can NOT easily use any other version of opencv in noetic. You could try to build ros packages from source, but even then ROS might not work correctly because the opencv API changes frequently.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-11-02 21:57:01 -0500

Seen: 445 times

Last updated: Nov 03 '22