海思平台按需裁剪opencv

安装H3519A编译环境

参考海思自带手册安装即可

下载opencv源码

登录https://opencv.org/releases/,选择相应的版本进行下载。

编译前的准备工作

//进入源码根目录
mkdir build
mkdir output
cd build

编译

1.修改源码根目录的Cmakelists.txt,在510-520处的ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})的下边添加一行内容:
ocv_include_directories(./3rdparty/zlib/)
2.sudo apt-get install zlib1g-dev
3.按需写命令:

cmake ../ -DCMAKE_C_COMPILER=arm-himix200-linux-gcc -DCMAKE_CXX_COMPILER=arm-himix200-linux-g++ -DOPENCV_FORCE_3RDPARTY_BUILD=ON -DBUILD_ZLIB=ON -DZLIB_INCLUDE_DIR=../3rdparty/zlib -DWITH_GTK=OFF -DWITH_GTK=OFF -DWITH_GTK_2_X=OFF -DWITH_CUDA=OFF -DWITH_IPP=OFF -DWITH_OPENCL=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_QUIRC=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_1394=OFF -DWITH_FFMPEG=OFF -DWITH_WEBP=OFF -DWITH_TIFF=OFF -DWITH_OPENEXR=OFF -DWITH_PNG=OFF -DWITH_PROTOBUF=OFF -DWITH_GSTREAMER=OFF -DWITH_IMGCODEC_SUNRASTER=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_opencv_ts=OFF -DBUILD_opencv_shape=OFF -DBUILD_opencv_stitching=OFF -DBUILD_opencv_apps=OFF -DBUILD_opencv_calib3d=OFF -DBUILD_opencv_dnn=OFF -DBUILD_opencv_features2d=OFF -DBUILD_opencv_flann=OFF -DBUILD_opencv_ml=OFF -DBUILD_opencv_objdetect=OFF -DBUILD_opencv_photo=OFF -DBUILD_opencv_video=OFF -DBUILD_opencv_videoio=OFF -DBUILD_opencv_videostab=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=../output

然后make
make install
最终在{OpenCV 源码根目录}/output下生成了bin 、 include、lib、share四个文件夹。lib文件夹中是我们所需要的动态库。

你可能感兴趣的:(opencv,人工智能)