How to Install OpenCV with CUDA Support on Jetson Modules?

How to Install OpenCV with CUDA Support on Jetson Modules?

Jetson AGX Xavier | Jetson Nano | Jetson TX2 NX | Jetson Xavier NX

27 September 2021
ENVIRONMENT

Hardware: DSBOARD-NX2 with Jetson Xavier NX

OS: Jetpack 4.6



In this blog post, you will learn how to install OpenCV with CUDA support and test whether it is installed correctly using a sample stream. 

How to Install OpenCV with CUDA Support?


Download and extract the archive that provided in the top of this blog. Then, open a terminal into the folder that is the archive is located. Type this command below:


$ sudo ./opencv-install.sh




This script file will remove the default OpenCV packages (if you have another OpenCV libraries installed into /usr/local, you may want to remove them before), install required libraries and install the custom OpenCV package.


How to Test OpenCV on Jetson Modules?


After installation ended, you can test the OpenCV Python package with tracker sample that is provided in the archive:


$ python3 opencv_python3_tracker.py

The ROI selector tool will be open to define the item that is to be tracked. After you finish drawing the box, press SPACE or ENTER button to start the tracking. If you wish to cancel the selection, press C button.



Tracking large items will decrease the performance, so we created an ROI around a bag.


Thank you for reading our blog post.

Türkçe