opencv contib教程2017-09-12 12:41:07

( 1人已投票,[高质量] )
分享:
31.3K

注意事项:

cmake失败,是远程连接被墙造成的,可以下载那几个包,放入download

Opencv_contrib安装完成,但是有许多东西没有,在生成解决方案的时候,看一下是不是120个项目(Solution Opencv(120 project)如果数目不对,也不应差太多才是,如果差太多,说明你的cmake就没有编译完成,你关掉cmake后不应有提示,如果提示未编译警告,说明最后一步你弄错了,不是configure而是generate,这样关掉cmake才没提示,好多教程这块写的有问题)

VC++目录-->包含目录,添加:D:\opencv3\opencv\mybuild\install\include

VC++目录-->库目录,添加:

D:\opencv3\opencv\mybuild\install\x86\vc12\lib

D:\opencv3\opencv\mybuild\install\x86\vc12\staticlib

注意:这几个路径你需要实地确认的,不可按网上的来抄写,还有环境变量中的也要是mybuild,因为从头到尾都是生成在mybuild里面!切记!还要看准了那install文件夹,这与添加opencv_contrib之间是不一样的,希望你能发现!

链接器-->输入-->附加依赖项,添加:xxxxd.lib这些库有哪些,在哪里能找到,当然在mybuild里面了,D:\opencv\mybuild\install\x64\vc14\lib等等,实地查看一下比较妥当,可以到mybuild文件夹里搜一下,随便搜比如*.lib出来的lib一大堆,看下地址,就行了。F2直接选中名字,编辑好在txt文件中一次copy到链接器的输入选项中。下面我已经弄好了我的,你可以试一试,另外如果你添加了不存在的的库,编译项目的时候,会在下面直接提示这个库不存在的,这好办,直接去配置中找到它,确认名字是不是打错了,或是直接删掉就OK了。

464位与x86是有区别的,如果选了,要一直用这个,不可切换来切换去的,还有releasedebug也一样,运行时也要相当注意,选择不对,一样加载不上去的,另外xxxd.lib这个d就是debug的意思。Debug调试比较方便,而release速度较快,但报的错误可能没那么细致了。

重新生成项目opecv.sln解决方案时,时间会很长,十来分钟,时间太短的肯定有问题,而且成功了会有提示Rebuild All: 113 succeeded, 0 failed, 7 skipped

如果没有这个提示,说明失败了,前面部分没有做对,就不要再往后面进行了。

opencv_aruco320d.lib

opencv_bgsegm320d.lib

opencv_bioinspired320d.lib

opencv_calib3d320d.lib

opencv_ccalib320d.lib

opencv_core320d.lib

opencv_datasets320d.lib

opencv_dnn320d.lib

opencv_dpm320d.lib

opencv_face320d.lib

opencv_features2d320d.lib

opencv_flann320d.lib

opencv_fuzzy320d.lib

opencv_highgui320d.lib

opencv_imgcodecs320d.lib

opencv_imgproc320d.lib

opencv_line_descriptor320d.lib

opencv_ml320d.lib

opencv_objdetect320d.lib

opencv_optflow320d.lib

opencv_phase_unwrapping320d.lib

opencv_photo320d.lib

opencv_plot320d.lib

opencv_reg320d.lib

opencv_rgbd320d.lib

opencv_saliency320d.lib

opencv_shape320d.lib

opencv_stereo320d.lib

opencv_stitching320d.lib

opencv_structured_light320d.lib

opencv_superres320d.lib

opencv_surface_matching320d.lib

opencv_text320d.lib

opencv_tracking320d.lib

opencv_video320d.lib

opencv_videoio320d.lib

opencv_videostab320d.lib

opencv_xfeatures2d320d.lib

opencv_ximgproc320d.lib

opencv_xobjdetect320d.lib

opencv_xphoto320d.lib


下面开详细讲解如何用cmake安装contrb

一、下载安装


OpenCV3.0下载地址:http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/



OpenCVcontrib下载地址:https://github.com/Itseez/opencvcontrib



cmake-gui下载地址:http://wwwNaNake.org/cmake/resources/software.html


下载以上内容并安装opencvcmake-gui,我的OpenCV安装路径为D:\opencv3

二、使用cmake生成OpenCV.sln


打开cmake-gui



where is the source code选择opencv的安装目录,我的是D:\opencv3\opencv\sources



where to build the binaries里面选择要将opencv编译到的目录下面,我的是:D:\opencv3\opencv\mybuild



点击configure,在弹出的对话框内选择 Visual Studio 2013default参数,点击finish



这个时候cmake会开始编译不知道什么东西,然后会在屏幕中间出现一堆参数包括NameValue,在其中找到NameOPENCVEXTRAMODULESPATH的参数,然后把它的Value设置为opencvcontrib的路径,我的是D:/Files/Codes/Tracking/Exp/opencvcontrib-master/opencvcontrib-master/modules



然后点击Generate,等待。中间报了两次错,我去掉了BUILDopencvadasWITH_CUDA等一系列看起来没用的东西,然后就完成了。


三、用VS编译生成debugrelease


打开D:\opencv3\opencv\mybuild目录下的OpenCV.sln



编译debug版本库:在解决方案'OpenCV'141个项目)上面点击右键-->重新生成解决方案。



找到CMakeTargets中的INSTALL,然后右键选择仅限于项目”-->“仅生成INSTALL”,然后就在D:\opencv3\opencv\mybuild\install中发现了许多东东。


四、重新配置自己的项目


VC++目录-->包含目录,添加:D:\opencv3\opencv\mybuild\install\include



VC++目录-->库目录,添加:
D:\opencv3\opencv\mybuild\install\x86\vc12\lib
D:\opencv3\opencv\mybuild\install\x86\vc12\staticlib



链接器-->输入-->附加依赖项,添加(当然你可能不需要这么多,可跟据需要减少,都添上也无所谓):


opencv_bgsegm300d.lib
opencv_bioinspired300d.lib
opencv_calib3d300d.lib
opencv_ccalib300d.lib
opencv_core300d.lib
opencv_datasets300d.lib
opencv_face300d.lib
opencv_features2d300d.lib
opencv_flann300d.lib
opencv_hal300d.lib
opencv_highgui300d.lib
opencv_imgcodecs300d.lib
opencv_imgproc300d.lib
opencv_latentsvm300d.lib
opencvlinedescriptor300d.lib
opencv_ml300d.lib
opencv_objdetect300d.lib
opencv_optflow300d.lib
opencv_photo300d.lib
opencv_reg300d.lib
opencv_rgbd300d.lib
opencv_saliency300d.lib
opencv_shape300d.lib
opencv_stereo300d.lib
opencv_stitching300d.lib
opencv_superres300d.lib
opencvsurfacematching300d.lib
opencv_text300d.lib
opencv_tracking300d.lib
opencv_ts300d.lib
opencv_video300d.lib
opencv_videoio300d.lib
opencv_videostab300d.lib
opencv_xfeatures2d300d.lib
opencv_ximgproc300d.lib
opencv_xobjdetect300d.lib
opencv_xphoto300d.lib
ippicvmt.lib



只需修改三处:

系统环境变量:

install:

D:\opencv\mybuild\install\x64\vc14\bin


path:

D:\opencv\mybuild\install\x64\vc14\bin;


VS2015

//可执行目录

//$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);


包含目录:

D:\opencv\mybuild\install\include;

D:\opencv\mybuild\install\include\opencv;

D:\opencv\mybuild\install\include\opencv2;

$(IncludePath)


库目录:

D:\opencv\mybuild\install\x64\vc14\lib;

$(LibraryPath)


包含库:

opencv_aruco320d.lib;

opencv_bgsegm320d.lib;

opencv_bioinspired320d.lib;

opencv_calib3d320d.lib;

opencv_ccalib320d.lib;

opencv_core320d.lib;

opencv_datasets320d.lib;

opencv_dnn320d.lib;

opencv_dpm320d.lib;

opencv_face320d.lib;

opencv_features2d320d.lib;

opencv_flann320d.lib;

opencv_fuzzy320d.lib;

opencv_highgui320d.lib;

opencv_imgcodecs320d.lib;

opencv_imgproc320d.lib;

opencv_line_descriptor320d.lib;

opencv_ml320d.lib;

opencv_objdetect320d.lib;

opencv_optflow320d.lib;

opencv_photo320d.lib;

opencv_plot320d.lib;

opencv_reg320d.lib;

opencv_rgbd320d.lib;

opencv_shape320d.lib;

opencv_tracking320d.lib;

opencv_video320d.lib;

opencv_videoio320d.lib;

opencv_videostab320d.lib;

opencv_xfeatures2d320d.lib;

%(AdditionalDependencies)






头像

snowcoal
  • opencv
  • contirb
  • cmake

本文标签:

opencvcontirbcmake

收藏到我的私密空间

标题:opencv contib教程

作者:柳岸花明

你暂未登录,请登录后才可收藏至您的私密空间 确认取消
雪炭网

键盘操作 更便捷 -雪炭网雪中送炭-乐趣无限

如果本站的内容有幸帮助到了您,建议您了解一下当页的广告内容哦,我们的进步离不开您的支持,Thank you~