jetsonhacks/buildOpenCVTX2

How to install opencv-contrib on jetson tx2

zhudaoruyi opened this issue · 7 comments

How to install opencv-contrib on jetson tx2

I have the same question. I've already set DOWNLOAD_OPENCV_EXTRAS=YES and still when trying to get a build, I got this:

fatal error: opencv2/xfeatures2d.hpp: No such file or directory
#include "opencv2/xfeatures2d.hpp"
^
compilation terminated.

Looks like opencv_contrib was not installed. @jetsonhacks Please help! Thanks!

Looks like opencv_extra isn't opencv_contrib. That's why my build failed.

I have solved this problem.

change as bellow:

DOWNLOAD_OPENCV_EXTRAS=YES

and this,

if [ $DOWNLOAD_OPENCV_EXTRAS == "YES" ] ; then
 echo "Installing opencv_extras"
 # This is for opencv contrib
 cd $OPENCV_SOURCE_DIR
 git clone https://github.com/opencv/opencv_contrib.git
 cd opencv_contrib

 git checkout -b v${OPENCV_VERSION} ${OPENCV_VERSION}

and this,

time cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
      -D WITH_CUDA=ON \
      -D CUDA_ARCH_BIN=${ARCH_BIN} \
      -D CUDA_ARCH_PTX="" \
      -D ENABLE_FAST_MATH=ON \
      -D CUDA_FAST_MATH=ON \
      -D WITH_CUBLAS=ON \
      -D WITH_LIBV4L=ON \
      -D WITH_GSTREAMER=ON \
      -D WITH_GSTREAMER_0_10=OFF \
      -D WITH_QT=ON \
      -D WITH_OPENGL=ON \
      -D OPENCV_EXTRA_MODULES_PATH=/home/nvidia/opencv_contrib/modules \
      -D BUILD_opencv_legacy=OFF \
      ../

Hi - I just opened a PR for this: #24

https://github.com/zhudaoruyi/buildOpenCVTX2
@zhudaoruyi Thanks, the solution works. One thing is to remember to change the OPENCV_EXTRA_MODULES_PATH to the customized one.

Hi, I have a problem with cudnn.
when I had with_cudnn = ON I get an error :
"found unsuitable version 7.3.1" but required is at least "7.5".
I am using the cuda and cudnn lib "coming" with the jetpack 4.2 and indeed it is libcudnn7_7.3.1.28-1+cuda10.0_arm64.deb which is included.
is there a way to solve this problem ?
(i am trying to do

net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)

in python3.6 opencv)