opencv4 安装脚本

  • x86平台(无cuda编译选项)
sudo apt-get install ffmpeg
sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev
rm -rf opencv_x86
mkdir opencv_x86
cd opencv_x86
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PERFIX=/usr/local -DBUILD_EXAMPLES=ON -DWITH_FFMPEG=ON -DWITH_QT=ON -DCMAKE_GENERATE_PKGCONFIG=ON -DWITH_GSTREAMER=ON  ..

make -j14
  • android平台
!/bin/zsh

export BASE_PATH=${HOME}/Downloads
export NDK_PATH=${BASE_PATH}/android-ndk-r17c

rm -rf android_build
mkdir android_build
cd android_build

cmake    -DANDROID_NDK=${NDK_PATH} \
         -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
         -DANDROID_PLATFORM=android-21 \
         -DANDROID_STL=c++_shared \
         -DANDROID_ABI=arm64-v8a \
         -DCMAKE_ANDROID_ARM_NEON=ON \
         -DBUILD_ANDROID_PROJECTS=OFF \
         -DBUILD_SHARED_LIBS=ON \
         -DBUILD_opencv_world=ON \
         -DCMAKE_INSTALL_PREFIX=./android_install \
         -DCMAKE_BUILD_TYPE=Release $@ ..

cmake --build . --config Release -- -j8

你可能感兴趣的:(计算机基础)