buildOpenCVTX2 icon indicating copy to clipboard operation
buildOpenCVTX2 copied to clipboard

Example Error - Python is missing OpenCV

Open JohannesBetz opened this issue 6 years ago • 2 comments

Hello,

i did you installation tutorial as you said. But it seems like, my python doesnt know which OpenCV version to use. When i try your Example, i get an error and the hint, that python is accessing openCV version 3.3.1 The error looks like this Called with args: Namespace(video_device=0) OpenCV version: 3.3.1-dev ('Device Number:', 0) camera open failed I think python doesnt know that i build openCV from source. I double checked in the terminal an i get these issues:

`nvidia@tegra-ubuntu:~/OpenCVTX2/Examples$ python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.

import cv Traceback (most recent call last): File "", line 1, in ImportError: No module named 'cv' import cv2 Traceback (most recent call last): File "", line 1, in ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type ` What have i done wrong in the build process?

JohannesBetz avatar May 30 '18 19:05 JohannesBetz

It is using the PYTHONPATH which is set to the ROS 2.7 OpenCV version:

/opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so

ROS uses its own OpenCV library.

jetsonhacks avatar May 30 '18 19:05 jetsonhacks

Easiest way: Remove ROS from your jetson. Then set the path of opencv. If you don't want remove ROS, you have to separate non-ROS usage and ROS usage.

I believe you can control from your ~/.bashrc file. There should be "source /opt/ros/{$ROS_DISTRO}/setup.bash" or something like that.

joonr7 avatar Nov 15 '18 13:11 joonr7