纯净水企业怎样做网站,长春建站程序,wordpress官网模板,如何查网站点击量OpenCV中有很多模块#xff0c;模块间保持最小的依赖关系#xff0c;用户可以根据自己的实际需要链接相关的库#xff0c;而不需链接所有的库#xff0c;这样在最终交付应用程序时可以减少总库的大小。但如果需要依赖OpenCV的库太多,有时会带来不方便#xff0c;此时可以使… OpenCV中有很多模块模块间保持最小的依赖关系用户可以根据自己的实际需要链接相关的库而不需链接所有的库这样在最终交付应用程序时可以减少总库的大小。但如果需要依赖OpenCV的库太多,有时会带来不方便此时可以使用OpenCV的world模块。 OpenCV中的world模块也称为超级模块(super-module),它结合了用户选择的所有其它模块。它是一个一体化(all-in-one)模块,具有所有库的功能。使用world模块可能会使应用程序的编译时间略有增加。 目前OpenCV最新发布版本为4.8.1,编译不带world模块的动态库在windows下会有58个动态库。在windows上使用vs2022及在linux上使用g 9的脚本build.sh如下所示
#! /bin/bashif [ $# ! 2 ]; thenecho Error: requires two parameters: 1: windows or linux; 2: relese or debugecho For example: $0 windows debugexit -1
fiif [ $1 ! windows ] [ $1 ! linux ]; thenecho Error: the first parameter can only be windows or linuxexit -1
fiif [ $2 ! release ] [ $2 ! debug ]; thenecho Error: the second parameter can only be release or debugexit -1
fiif [[ ! -d build ]]; thenmkdir buildcd build
elsecd build
fiif [ $1 windows ] [ $2 release ]; thencmake \-GVisual Studio 17 2022 -A x64 \-DCMAKE_BUILD_TYPERelease \-DCMAKE_CONFIGURATION_TYPESRelease \-DBUILD_SHARED_LIBSON \-DBUILD_opencv_worldON \-DBUILD_PERF_TESTSOFF \-DBUILD_TESTSOFF \-DCMAKE_INSTALL_PREFIX../install_4.8.1/ \-DOPENCV_EXTRA_MODULES_PATH../../opencv_contrib/modules \..cmake --build . --target install --config release
fiif [ $1 windows ] [ $2 debug ]; thencmake \-GVisual Studio 17 2022 -A x64 \-DCMAKE_BUILD_TYPEDebug \-DCMAKE_CONFIGURATION_TYPESDebug \-DBUILD_SHARED_LIBSON \-DBUILD_opencv_worldON \-DBUILD_PERF_TESTSOFF \-DBUILD_TESTSOFF \-DCMAKE_INSTALL_PREFIX../install_4.8.1/ \-DOPENCV_EXTRA_MODULES_PATH../../opencv_contrib/modules \..cmake --build . --target install --config debug
fiif [ $1 linux ] [ $2 release ]; thencmake \-DCMAKE_C_COMPILER/usr/bin/gcc-9 \-DCMAKE_CXX_COMPILER/usr/bin/g-9 \-DCMAKE_BUILD_TYPERelease \-DBUILD_SHARED_LIBSON \-DBUILD_opencv_worldON \-DBUILD_PERF_TESTSOFF \-DBUILD_TESTSOFF \-DCMAKE_INSTALL_PREFIX../install_4.8.1/release/ \-DOPENCV_EXTRA_MODULES_PATH../../opencv_contrib/modules \..make -j4make install
fiif [ $1 linux ] [ $2 debug ]; thencmake \-DCMAKE_C_COMPILER/usr/bin/gcc-9 \-DCMAKE_CXX_COMPILER/usr/bin/g-9 \-DCMAKE_BUILD_TYPEDebug \-DCMAKE_CONFIGURATION_TYPESDebug \-DBUILD_SHARED_LIBSON \-DBUILD_opencv_worldON \-DBUILD_PERF_TESTSOFF \-DBUILD_TESTSOFF \-DCMAKE_INSTALL_PREFIX../install_4.8.1/debug/ \-DOPENCV_EXTRA_MODULES_PATH../../opencv_contrib/modules \..make -j4make install
firc$?
if [[ ${rc} ! 0 ]]; thenecho Error: please check: ${rc}exit ${rc}
fi 在windows上编译结果如下所示 在Linux上编译结果如下所示 GitHubhttps://github.com/fengbingchun/OpenCV_Test