《OpenCV图像处理编程实例》
Posted alliswell-wp
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了《OpenCV图像处理编程实例》相关的知识,希望对你有一定的参考价值。
《OpenCV图像处理编程实例》例程复现
随书代码下载:http://www.broadview.com.cn/28573
总结+遇到的issue解决:
第一章
1.VS2015安装OpenCV2.4.11
四步骤:
1)步骤一:下载Windows安装包OpenCV2.4.11并解压,本人为:D:\ProgramFiles\opencv2
2)步骤二:配置OpenCV2.4.11的环境变量,本人为:D:\ProgramFiles\opencv2\opencv\build\x86\vc12\bin
注意:此处实际此处与系统32位还是64位无关,而与在VS2015工程项目中配置的平台相关,所以,本人电脑64位系统,若添加D:\ProgramFiles\opencv2\opencv\build\x86\vc12\bin,在VS2015工程项目中配置的平台中选择x86,而若若添加D:\ProgramFiles\opencv2\opencv\build\x86\vc12\bin 和 D:\ProgramFiles\opencv2\opencv\build\x64\vc12\bin,在VS2015工程项目中配置的平台选择x86和x64均可,但是步骤三配置VS工程目录要对应。
3)步骤三:配置VS工程目录
包括:新建空白项目Win32控制台应用程序,属性页面:配置:选择“Debug”平台选择“Win32”需要配置3处:VC++目录(包含目录、库目录)和链接器——“输入”(附加依赖项)
选择“Release”平台选择“Win32”需要配置3处:同上。
本人配置的为:配置:选择“Debug”平台选择“Win32”需要配置3处:VC++目录(包含目录:D:\ProgramFiles\opencv2\opencv\build\include、D:\ProgramFiles\opencv2\opencv\build\include\opencv、D:\ProgramFiles\opencv2\opencv\build\include\opencv2;库目录:D:\ProgramFiles\opencv2\opencv\build\x86\vc12\lib)和链接器——“输入”(附加依赖项:opencv_calib3d2411d.lib
opencv_contrib2411d.lib
opencv_core2411d.lib
opencv_features2d2411d.lib
opencv_flann2411d.lib
opencv_gpu2411d.lib
opencv_highgui2411d.lib
opencv_imgproc2411d.lib
opencv_legacy2411d.lib
opencv_ml2411d.lib
opencv_nonfree2411d.lib
opencv_objdetect2411d.lib
opencv_ocl2411d.lib
opencv_photo2411d.lib
opencv_stitching2411d.lib
opencv_superres2411d.lib
opencv_ts2411d.lib
opencv_video2411d.lib
opencv_videostab2411d.lib)
配置:选择“Release”平台选择“Win32”需要配置3处:VC++目录(包含目录:D:\ProgramFiles\opencv2\opencv\build\include、D:\ProgramFiles\opencv2\opencv\build\include\opencv、D:\ProgramFiles\opencv2\opencv\build\include\opencv2;库目录:D:\ProgramFiles\opencv2\opencv\build\x86\vc12\lib)和链接器——“输入”(附加依赖项:opencv_calib3d2411.lib
opencv_contrib2411.lib
opencv_core2411.lib
opencv_features2d2411.lib
opencv_flann2411.lib
opencv_gpu2411.lib
opencv_highgui2411.lib
opencv_imgproc2411.lib
opencv_legacy2411.lib
opencv_ml2411.lib
opencv_nonfree2411.lib
opencv_objdetect2411.lib
opencv_ocl2411.lib
opencv_photo2411.lib
opencv_stitching2411.lib
opencv_superres2411.lib
opencv_ts2411.lib
opencv_video2411.lib
opencv_videostab2411.lib)
注意:(1)以本人配置的位列,若要配置64位系统的库目录应为:D:\ProgramFiles\opencv2\opencv\build\x64\vc12\lib
(2)若库目录配置为staticlib,这样开发出来的软件将包含opencv库,可以运行于没有安装配置OpenCV开发环境的系统中。如若配置,库目录应为:D:\ProgramFiles\opencv2\opencv\build\x64\vc12\staticlib
4)步骤四:测试OpenCV开发环境是否正确配置。
注意:此处的图像地址一定要正确,本人的是:D:\\Working\\opencvimg\\images\\flower.jpg
2.
3.
以上是关于《OpenCV图像处理编程实例》的主要内容,如果未能解决你的问题,请参考以下文章
[实例]ROS使用OpenCV读取图像并发布图像消息在rviz中显示