Ubuntu18.04交叉编译 opencv-3.4.6(armv7版本)带opencv_contrib模块

源码目录为:/opt/opencv/opencv-3.4.6
安装目录为:/opt/armv7/lib

1.cd /opt/opencv/opencv-3.4.6
2.mkdir build-armv7
3.cd build-armv7
4.sudo cmake -DCMAKE_INSTALL_PREFIX=/opt/armv7/lib/ - DMAKE_TOOLCHAIN_FILE=/opt/opencv/opencv-3.4.6/platforms/linux/arm-gnueabi.toolchain.cmake /opt/opencv/opencv-3.4.6 -DOPENCV_EXTRA_MODULES_PATH=/opt/opencv/opencv-3.4.6/opencv_contrib/modules
5.sudo make -j
6.sudo make install

注释:-DOPENCV_EXTRA_MODULES_PATH=/opt/opencv/opencv-3.4.6/opencv_contrib/modules 是下载好opencv_contrib包的路径,我已经解压放到/opt/opencv/opencv-3.4.6下了。

-DCMAKE_INSTALL_PREFIX=/opt/armv7/lib 指定安装目录

-DMAKE_TOOLCHAIN_FILE=/opt/opencv/opencv-3.4.6/platforms/linux/arm-gnueabi.toolchain.cmake 需要编译的版本所需的工具链 我需要编译成armv7版 所以需要arm-gnueabi.toolchain.cmake

你可能感兴趣的:(Ubuntu18.04交叉编译 opencv-3.4.6(armv7版本)带opencv_contrib模块)