Python opencv on jetpack 5.1.4

Hi, I want to reactivate my old Xavier NX to build a robot head. I want to use 2 pi cameras for the eyes.

Does the jetpack 5.1.4 or 5.1.5 support python opencv with gstreamer and cuda support ?

I have a version of the jetpack installed, but i don’t know why, but the installed python opencv version does not support gstreamer, and all new rebuilds failed so far.

I have no decided to start from a fresh jetpack version.

Hi,

You can build it from the source.
Please find our script below:

Thanks.

Hi, thanks a lot, but i ran into the following error :

: Unable to locate package v4l2ucp

I changed the line

sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp

to

sudo apt-get install -y libv4l-dev v4l-utils qv4l2

but ended with the following erros

             from /home/marc/Development/Python/pypro/workspace/opencv-4.6.0/modules/python/src2/cv2.cpp:11:

/home/marc/Development/Python/pypro/workspace/opencv_contrib-4.6.0/modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp:121:26: warning: ‘virtual void cv::cuda::DescriptorMatcher::clear()’ can be marked override [-Wsuggest-override]
121 | CV_WRAP virtual void clear() = 0;
| ^~~~~
/home/marc/Development/Python/pypro/workspace/opencv_contrib-4.6.0/modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp:125:26: warning: ‘virtual bool cv::cuda::DescriptorMatcher::empty() const’ can be marked override [-Wsuggest-override]
125 | CV_WRAP virtual bool empty() const = 0;
| ^~~~~
In file included from /home/marc/Development/Python/pypro/workspace/opencv-4.6.0/release/modules/python_bindings_generator/pyopencv_generated_include.h:89,
from /home/marc/Development/Python/pypro/workspace/opencv-4.6.0/modules/python/src2/cv2.cpp:11:
/home/marc/Development/Python/pypro/workspace/opencv_contrib-4.6.0/modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp:121:26: warning: ‘virtual void cv::cuda::DescriptorMatcher::clear()’ can be marked override [-Wsuggest-override]
121 | CV_WRAP virtual void clear() = 0;
| ^~~~~
/home/marc/Development/Python/pypro/workspace/opencv_contrib-4.6.0/modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp:125:26: warning: ‘virtual bool cv::cuda::DescriptorMatcher::empty() const’ can be marked override [-Wsuggest-override]
125 | CV_WRAP virtual bool empty() const = 0;
| ^~~~~
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/build.make:63: modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:6810: modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
[100%] Linking CXX shared module ../../lib/python3/cv2.cpython-38-aarch64-linux-gnu.so
[100%] Built target opencv_python3
make: *** [Makefile:163: all] Error 2

Once the script terminated, do I have to do something with python ? where does the gstreamer support comes from ? from the compiled opencv library or from the python opencv module?

Could you please share the output from:

python3 -c “import cv2; print(cv2.file)”

Regards,

Embedded Software Engineer
RidgeRun | https://www.ridgerun.com/

Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/

Hi,

This error is related to the out-of-memory.
Could you try to reduce the -j variable to a lower value? Ex. make -j4.

Thanks.

hi, the command returns

/home/marc/.local/lib/python3.8/site-packages/cv2/init.py

ok, with the option -j 1 i get a correct result

** Install opencv 4.6.0 successfully
** Bye :)

However, the python library has not changed, so opencv in python still using gsGSTreamer No

Hi,

echo 'export PYTHONPATH=/usr/local/lib/python3.8/site-packages/:$PYTHONPATH' >> ~/.bashrc

Please double-check if you have loaded the Python OpenCV correctly.
Maybe you can also check this by checking the version information.

Thanks.

Hello,

Check this wiki: Compiling OpenCV from Source | RidgeRun Developer Wiki

It shows how to compile OpenCV from source with Gstreamer support.

Regards,

Embedded Software Engineer
RidgeRun | https://www.ridgerun.com/

Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.