NVIDIA Jetson TX2安装opencv4.1

mkdir build
vim cv_cmake.sh
#!/bin/bash
cmake \
        -D CMAKE_BUILD_TYPE=Release \
        -D CMAKE_INSTALL_PREFIX=/usr \
        -D BUILD_PNG=OFF \
        -D BUILD_TIFF=OFF \
        -D BUILD_TBB=OFF \
        -D BUILD_JPEG=OFF \
        -D BUILD_JASPER=OFF \
        -D BUILD_ZLIB=OFF \
        -D BUILD_EXAMPLES=ON \
        -D BUILD_opencv_java=OFF \
        -D BUILD_opencv_python2=OFF \
        -D BUILD_opencv_python3=ON \
        -D ENABLE_PRECOMPILED_HEADERS=OFF \
        -D WITH_OPENCL=OFF \
        -D WITH_OPENMP=OFF \
        -D WITH_FFMPEG=ON \
        -D WITH_GSTREAMER=ON \
        -D WITH_GSTREAMER_0_10=OFF \
        -D WITH_CUDA=OFF \
        -D WITH_GTK=ON \
        -D WITH_VTK=OFF \
        -D WITH_TBB=ON \
        -D WITH_1394=OFF \
        -D WITH_OPENEXR=OFF \
        -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=/root/opencv_contrib-4.1.1/modules/ \
        ..

编译报错

[ 76%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/test_OF_accuracy.cpp.o
Scanning dependencies of target example_ximgproc_structured_edge_detection
[ 76%] Building CXX object modules/ximgproc/CMakeFiles/example_ximgproc_structured_edge_detection.dir/samples/structured_edge_detection.cpp.o
[ 76%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/boostdesc.cpp.o
/root/opencv_contrib-4.1.1/modules/xfeatures2d/src/boostdesc.cpp:654:20: fatal error: boostdesc_bgm.i: No such file or directory
           #include "boostdesc_bgm.i"
                    ^~~~~~~~~~~~~~~~~
compilation terminated.

解决办法
下载文件,放到opencv_contrib/modules/xfeatures2d/src/目录下
下载方法,自行百度

编译报错

[ 92%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_test_xfeatures2d.dir/test/test_features2d.cpp.o
/root/opencv_contrib-4.1.1/modules/xfeatures2d/test/test_features2d.cpp:51:10: fatal error: features2d/test/test_detectors_regression.impl.hpp: No such file or directory
 #include "features2d/test/test_detectors_regression.impl.hpp"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

解决办法
拷贝opencv-4.1.1/modules/features2d目录到build目录下

参考
https://blog.csdn.net/g678678/article/details/116517140

posted @ 2022-12-05 19:12  thomas_blog  阅读(265)  评论(0编辑  收藏  举报