original opencv is 3.3.0 cause the jetpack4.2.1 auto install.
Now i want to used the GPU part of opencv ,so download the package opencv4.2.0 and opencv4.2.0_contrib .
Uninstall part
-
sudo apt-get purge libopencv*
-
sudo apt autoremove
-
sudo apt-get update
note:didn't choose the method of find,cause it may not safe for me.
compile part
lack some of the file in the "opencv-4.2.0/opencv_contrib-4.2.0/modules/xfeatures2d/src"
find in here for free.
https://pan.baidu.com/s/1SmRMg_aydPYOJ1jKNjGZPw
code:z7dp
If you got VPN,then find the website from the "CMakeDownloadLog.txt"
my_cmake.sh (decide what to compile put inside build file)
#!/bin/bash
cmake \
-D CMAKE_BUILD_TYPE=Release \
-D CUDA_GENERATION=Pascal \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_opencv_python2=ON \
-D BUILD_opencv_python3=ON\
-D WITH_GSTREAMER=ON \
-D WITH_CUDA=ON \
-D WITH_CUDNN=ON \
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.0 \
-D CUDA_ARCH_BIN=6.2 \
-D CUDA_ARCH_PTX="" \
-D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.2.0/modules/ \
-D WITH_LIBV4L=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_EXAMPLES=OFF \
../
install part
sudo make install