VS2010 + OpenCV2.4.3 + Windows Form Application

时间:2015-12-17 17:07:00
【文件属性】:

文件名称:VS2010 + OpenCV2.4.3 + Windows Form Application

文件大小:4.79MB

文件格式:RAR

更新时间:2015-12-17 17:07:00

VS2010 OpenCV2.4.3 Windows

VS2010 + OpenCV2.4.3 + Windows Form Application (注意:如需引用本文请征得本人许可!) (原创)OpenCV在VS2010的Windows Form Application 的实现 以下为本人亲自验证过,含详细具体的安装编译及注意事项,完全可供参考!希望可以帮到OPENCV的爱好者(尤其是新兵)少走弯路.如需源码可邮件询索(后附). VS2010 + OpenCV2.4.3 ==================================================== 一.OpenCV的编译安装: 1.解压OpenCV-2.4.3.exe -> D:/OpenCV/Resources/OpenCV-2.4.3/opencv 2.运行CMake...为VS编译... Where is the source code(源码): D:/OpenCV/Resources/OpenCV-2.4.3/opencv Where is build the binaries(目标): D:/OpenCV/Resources/OpenCV-2.4.3/opencv/vs2010 Configure: 选择 Visual Studio 10/? Generate: 生成目标 3.打开D:/OpenCV/Resources/OpenCV-2.4.3/opencv/vs2010,用对应版本的VS打开OpenCV.sln... A.编译OpenCV方案Debug版本: 1,编译OpenCV方案(Debug): 在VS工作区界面左侧方案浏览器(Solution Explorer)中选中最顶项方案"Solution 'OpenCV' (61 projects)",确定Solution Configure为Debug,右键执行Build Soluton(编译方案); 2,编译ALL_BUILD项目(Debug): 在VS工作区界面左侧方案浏览器(Solution Explorer)列表中选中项目"ALL_BUILD",确定Solution Configure为Debug,右键执行Build(编译项目); 3,编译CMakeTargets\INSTALL项目(Debug): 在VS工作区界面左侧方案浏览器(Solution Explorer)列表中选中"CMakeTargets\INSTALL"项目,确定Solution Configure为Debug,右键执行Build(编译项目); B.编译OpenCV方案Release版本: 1,编译OpenCV方案(Release): 在VS工作区界面左侧方案浏览器(Solution Explorer)中选中最顶项方案"Solution 'OpenCV' (61 projects)",确定Solution Configure为Release,右键执行Build Soluton(编译方案); 2,编译ALL_BUILD项目(Release): 在VS工作区界面左侧方案浏览器(Solution Explorer)列表中选中项目"ALL_BUILD",确定Solution Configure为Release,右键执行Build(编译项目); 3,编译CMakeTargets\INSTALL项目(Release): 在VS工作区界面左侧方案浏览器(Solution Explorer)列表中选中"CMakeTargets\INSTALL"项目,确定Solution Configure为Release,右键执行Build(编译项目); 4.检查编译后的结果: D:\OpenCV\Resources\OpenCV-2.4.3\opencv\vs2010\bin: 有Debug/Release两目录及相关文件资源; D:\OpenCV\Resources\OpenCV-2.4.3\opencv\vs2010\lib: 有Debug/Release两目录及相关文件资源; D:\OpenCV\Resources\OpenCV-2.4.3\opencv\vs2010\install: 有bin/include/lib三目录及相关文件资源; 其它可不要求 5.应用配置: a.将编译好的目录D:\OpenCV\Resources\OpenCV-2.4.3\opencv\vs2010\install复制到C:\,并改名为C:\opencv; b.增加OSXP系统变量Path: c:\opencv\bin (供OpenCV的exe应用程序调用); c.增加OSXP系统变量OPENCV: 值为: C:\opencv; --------------------------------------------- 二.程序项目配置: 特别注意: 对项目属性的配置应注意Debug/Release两个版本各配置项的统一性,否则会引起可能的编译出错,如:Common Language Runtime Support(公共语言运行库支持): Common Language Runtime Support/(clr) (公共语言运行库支持(/clr)),否则将会导致编译出错! 6.VS应用(VS2010.控制台应用程序): 6.1,在VS项目属性中设置有下: 6.1.1,Configuration Properties(属性)/... a, General(常规): Use of MFC(MFC的使用): Use Standard Windows Libraries(使用标准 Windows 库) Use of ATL(ALT的使用): Not Using ATL(不使用 ATL) Common Language Runtime Support(公共语言运行库支持): No Common Language Runtime Support(无公共语言运行库支持,其它选项会出错) b, C/C++/General: Additonal Include Directories(附加包含目录): C:\opencv\include;c:\opencv\include\opencv;C:\opencv\include\opencv2 (可勾选Inherit from parent or project defaults(继承父级或项目默认值)) c, Linker/General: Additonal Library Directories(附加库目录): C:\opencv\lib (可勾选Inherit from parent or project defaults(继承父级或项目默认值)) 以上两项设置b,c(附加包含目录,附加库目录)均可在以下d等效替代等值设置: d, (VS2005无此项)VC++ Directories: Include Directories(包含目录): C:\opencv\include;c:\opencv\include\opencv;C:\opencv\include\opencv2 (可勾选Inherit from parent or project defaults(继承父级或项目默认值)) Library Directories(库目录): C:\opencv\lib (可勾选Inherit from parent or project defaults(继承父级或项目默认值)) e, Linker(链接器)/Input(输入)/Additional Libraries(附加依赖项):为项目属性引入库: Release版本:............... opencv_core243.lib opencv_highgui243.lib opencv_video243.lib opencv_photo243.lib opencv_calib3d243.lib opencv_contrib243.lib opencv_features2d243.lib opencv_flann243.lib opencv_gpu243.lib opencv_imgproc243.lib opencv_legacy243.lib opencv_ml243.lib opencv_nonfree243.lib opencv_objdetect243.lib opencv_stitching243.lib opencv_ts243.lib opencv_videostab243.lib Debug版本................... opencv_core243d.lib opencv_highgui243d.lib opencv_video243d.lib opencv_photo243d.lib opencv_calib3d243d.lib opencv_contrib243d.lib opencv_features2d243d.lib opencv_flann243d.lib opencv_gpu243d.lib opencv_imgproc243d.lib opencv_legacy243d.lib opencv_ml243d.lib opencv_nonfree243d.lib opencv_objdetect243d.lib opencv_stitching243d.lib opencv_ts243d.lib opencv_videostab243d.lib 6.2,在VS项目源码包含引用: //可用... #include #include #include #pragma comment( lib, "opencv_highgui243d.lib" ) #pragma comment( lib, "opencv_core243d.lib" ) #pragma comment( lib, "opencv_ml243d.lib" ) #pragma comment( lib, "opencv_imgproc243d.lib" ) using namespace cv; 三.程序范码(按钮事件): //按钮Show事件处理... namedWindow("show_image",WINDOW_AUTOSIZE); Mat src = imread("d:/opencv.jpg"); //while(1) { imshow("show_image", src); //char c = waitKey(0); //if(27 == ' ') //return 0; } //return 0; ============================================================================================ 资源: VS2010 + OpenCV2.4.3 + Windows Form Application 一.VS项目属性中设置有下: 6.1.1,Configuration Properties(属性)/... a, General(常规): Use of MFC(MFC的使用): Use Standard Windows Libraries(使用标准 Windows 库) Use of ATL(ALT的使用): Not Using ATL(不使用 ATL) Common Language Runtime Support(公共语言运行库支持): Common Language Runtime Support/(clr) (公共语言运行库支持(/clr)) b, C/C++/General: Additonal Include Directories(附加包含目录): c:\opencv\include;c:\opencv\include\opencv;c:\opencv\include\opencv2 (可勾选Inherit from parent or project defaults(继承父级或项目默认值)) c, Linker/General: Additonal Library Directories(附加库目录): c:\opencv\lib (可勾选Inherit from parent or project defaults(继承父级或项目默认值)) 以上两项设置b,c(附加包含目录,附加库目录)均可在以下d等效替代等值设置: d, (VS2005无此项)VC++ Directories: Include Directories(包含目录): c:\opencv\include;c:\opencv\include\opencv;C:\opencv\include\opencv2 (可勾选Inherit from parent or project defaults(继承父级或项目默认值)) Library Directories(库目录): c:\opencv\lib (可勾选Inherit from parent or project defaults(继承父级或项目默认值)) e, Linker(链接器)/Input(输入)/Additional Libraries(附加依赖项):为项目属性引入库: Release版本:............... opencv_core243.lib opencv_highgui243.lib opencv_video243.lib opencv_photo243.lib opencv_calib3d243.lib opencv_contrib243.lib opencv_features2d243.lib opencv_flann243.lib opencv_gpu243.lib opencv_imgproc243.lib opencv_legacy243.lib opencv_ml243.lib opencv_nonfree243.lib opencv_objdetect243.lib opencv_stitching243.lib opencv_ts243.lib opencv_videostab243.lib Debug版本................... opencv_core243d.lib opencv_highgui243d.lib opencv_video243d.lib opencv_photo243d.lib opencv_calib3d243d.lib opencv_contrib243d.lib opencv_features2d243d.lib opencv_flann243d.lib opencv_gpu243d.lib opencv_imgproc243d.lib opencv_legacy243d.lib opencv_ml243d.lib opencv_nonfree243d.lib opencv_objdetect243d.lib opencv_stitching243d.lib opencv_ts243d.lib opencv_videostab243d.lib 二.在VS项目源码包含引用: //包含引入OpenCV所需文件... #include #include #include //选用Debug/Release... #ifdef _DEBUG #pragma comment( lib, "opencv_highgui243d.lib" ) #pragma comment( lib, "opencv_core243d.lib" ) #pragma comment( lib, "opencv_ml243d.lib" ) #pragma comment( lib, "opencv_imgproc243d.lib" ) #else #pragma comment( lib, "opencv_highgui243.lib" ) #pragma comment( lib, "opencv_core243.lib" ) #pragma comment( lib, "opencv_ml243.lib" ) #pragma comment( lib, "opencv_imgproc243.lib" ) #endif using namespace cv; 三.程序范码(按钮事件): //按钮Show事件处理... namedWindow("show_image",WINDOW_AUTOSIZE); Mat src = imread("../opencv.jpg"); //while(1) { imshow("show_image", src); //char c = waitKey(0); //if(27 == ' ') //return 0; } //return 0;


【文件预览】:
cvwin2010
----cvwin2010()
--------app.ico(1KB)
--------resource.h(91B)
--------app.rc(2KB)
--------cvwin2010.vcxproj.user(143B)
--------Debug()
--------stdafx.h(242B)
--------ReadMe.txt(2KB)
--------FrmMain.resX(6KB)
--------Release()
--------stdafx.cpp(209B)
--------cvwin2010.vcxproj.filters(2KB)
--------AssemblyInfo.cpp(1KB)
--------FrmMain.h(3KB)
--------cvwin2010.vcxproj(6KB)
--------cvwin2010.cpp(442B)
----cvwin2010.sdf(12.89MB)
----Debug()
--------cvwin2010.exe(124KB)
--------cvwin2010.pdb(1.35MB)
--------cvwin2010.ilk(0B)
----opencv.jpg(6KB)
----cvwin2010.txt(3KB)
----Release()
--------cvwin2010.exe(112KB)
--------cvwin2010.pdb(1.31MB)
----cvwin2010.sln(894B)
----cvwin2010.suo(14KB)

网友评论

  • 这个可以用,谢谢楼主
  • 这个可以用,谢谢楼主
  • 可以用,赞一个
  • 楼主,好啊!你这个缺少LIB库,可以给相应的LIB库,谢谢!交流Q:1049568282
  • 这个可以用,配置成功了
  • 配置成功,很不错,谢谢
  • 很好用的东西!!
  • 没用成,好像还需要额外下载一些扩展库
  • 不错 我的是vs2010,正好用到这个版本
  • 过程很详细,需要仔细研究!
  • 不错,可以安装
  • 没有配置成功啊~估计是我太笨了~
  • 我的是vs2010,正在找这个东西呢,非常好
  • 我能用的到,很好啊
  • 挺好用的,谢谢。
  • 还不错,可以参考下~ 配置是有点麻烦~
  • 我能用的到,很好啊
  • 很基础的程序,不错
  • 这个VS2010 + OpenCV2.4.3的配置讲的非常详细,我按照这个做的,最后成功了。不过我的opencv版本是2.4.6的,其实都差不多一样的配置!非常感谢
  • 好,给我很大帮助,谢谢
  • 不错,按着步骤来可以安装
  • 不错 可以用
  • 东西还可以,不过不是我需要的.谢谢.
  • 配置比较麻烦,最后可以使用
  • 我能用的到,很好啊
  • 很不错,说的非常详细,很有指导性。。。。
  • 很基础的程序,不错
  • OpenCV的配置过程,说的比较详细,相信大家能在OpenCVChina等资源上看到类似,随着用户使用更多的配置和使用技巧可以在博客上看到,这些提醒是给积分少的用户的。
  • 用过很长时间了, 不错的东西啊
  • 很不错啊 按照指南成功了 谢了