在vs2010平台上配置opencv2.3.0(截图)_第1页
在vs2010平台上配置opencv2.3.0(截图)_第2页
在vs2010平台上配置opencv2.3.0(截图)_第3页
在vs2010平台上配置opencv2.3.0(截图)_第4页
在vs2010平台上配置opencv2.3.0(截图)_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

VS2010 + OpenCV2.3.0配置配置 ; 在在 VS2010下安装配置下安装配置 OpenCV2.3.0 ; 全程截图,绝对全程截图,绝对 能配置好能配置好 操作系统:Windows XP Windows 7 (家庭,旗舰版都可以.已经安装过) ; 编译环境:Visual Studio 2010; OpenCV 版本:OpenCV-2.3.0-win、OpenCV-2.3.1-win 也可以; 步骤:步骤: 1、下载 OpenCV(必须要 superpack.exe) /download/OpenCV-2.3.0-win-superpack.exe 2、安装 解压到 E 盘根目录下。 (位置随便,不过下面的 path 需要根据实际情况自行修改了。 ) 3、设置系统环境变量 我的电脑右键“属性” ,选择“高级” ,点“环境变量” 在用户变量处,新建 PATH 和 OPENCV 两个项: PATH (只需添加下面中的一行,根据系统情况自行选择) E:OpenCV2.3buildx86vc10bin OPENCV E:OpenCV2.3build 配置好后一定要重启电脑,不然之后运行会出错(好像是说缺少什么文件来着) 4、打开 VS2010 新建一个项目(OPENCVTEST) ,然后如图单击右键,选属性 (1)点击 VC+目录,在右边配置包含目录和库目录(注。配置(C)下拉框中,建议 选择所有配置,这样 Debug 运行,Release 运行就都可以了) 包含目录: E:OpenCV2.3buildinclude E:OpenCV2.3buildincludeopencv E:OpenCV2.3buildincludeopencv2 然后是库目录: E:OpenCV2.3buildx86vc10lib (2)在“Demo 属性页”(“配置”=“Debug”)-“配置属性”-“链接器”-“输入”- “附加依赖库”中追加下面一行(包括所有分号,勿删 VS 原始数据): ;opencv_core230d.lib;opencv_highgui230d.lib;opencv_video230d.lib;opencv_ ml230d.lib;opencv_legacy230d.lib;opencv_imgproc230d.lib (3) 、在“Demo 属性页”(“配置”=“Release”)-“配置属性”-“链接器”-“输入”- “附加依赖库”中追加下面一行(包括所有分号,勿删 VS 原始数据):直接复制下面一 段就好,分号不要少 ;opencv_core230.lib;opencv_highgui230.lib;opencv_video230.lib;opencv_ml2 30.lib;opencv_legacy230.lib;opencv_imgproc230.lib 5,。完成以后就可以跑一个小程序试试啦 (1)右击源文件,添加新项,选 C+文件,随便取个名 (2)将下面代码复制上去,F5执行,希望这个程序能让你爱上 OPENCV /* 程序名?:odrawingc 功|能:o展1示?OpenCV的?图?像?绘?制?功|能 */ #include “cv.h“ #include “highgui.h“ #include #include #define NUMBER 100 #define DELAY 5 char wndname = “Drawing Demo“; CvScalar random_color(CvRNG* rng) int icolor = cvRandInt(rng); return CV_RGB(icolor int main( int argc, char* argv ) int line_type = CV_AA; / change it to 8 to see non-antialiased graphics int i; CvPoint pt1,pt2; double angle; CvSize sz; CvPoint ptt6; CvPoint* pt2; int arr2; CvFont font; CvRNG rng; int width = 1000, height = 700; int width3 = width*3, height3 = height*3; CvSize text_size; int ymin = 0; / Load the source image IplImage* image = cvCreateImage( cvSize(width,height), 8, 3 ); IplImage* image2; / Create a window cvNamedWindow(wndname, 1 ); cvZero( image ); cvShowImage(wndname,image); rng = cvRNG(unsigned)-1); pt0 = pt1 = arr0 = 3; arr1 = 3; for (i = 0; i NUMBER; i+) pt1.x=cvRandInt( pt1.y=cvRandInt( pt2.x=cvRandInt( pt2.y=cvRandInt( cvLine( image, pt1, pt2, random_color( cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt1.x=cvRandInt( pt1.y=cvRandInt( pt2.x=cvRandInt( pt2.y=cvRandInt( cvRectangle( image,pt1, pt2, random_color( cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt1.x=cvRandInt( pt1.y=cvRandInt( sz.width =cvRandInt( sz.height=cvRandInt( angle = (cvRandInt( cvEllipse( image, pt1, sz, angle, angle - 100, angle + 200, random_color( cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt00.x=cvRandInt( pt00.y=cvRandInt( pt01.x=cvRandInt( pt01.y=cvRandInt( pt02.x=cvRandInt( pt02.y=cvRandInt( pt10.x=cvRandInt( pt10.y=cvRandInt( pt11.x=cvRandInt( pt11.y=cvRandInt( pt12.x=cvRandInt( pt12.y=cvRandInt( cvPolyLine( image, pt, arr, 2, 1, random_color( cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt00.x=cvRandInt( pt00.y=cvRandInt( pt01.x=cvRandInt( pt01.y=cvRandInt( pt02.x=cvRandInt( pt02.y=cvRandInt( pt10.x=cvRandInt( pt10.y=cvRandInt( pt11.x=cvRandInt( pt11.y=cvRandInt( pt12.x=cvRandInt( pt12.y=cvRandInt( cvFillPoly( image, pt, arr, 2, random_color( cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt1.x=cvRandInt( pt1.y=cvRandInt( cvCircle( image, pt1, cvRandInt( cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 1; i NUMBER; i+) pt1.x=cvRandInt( pt1.y=cvRandInt( cvInitFont( cvPutText( image, “Testing text rendering!“, pt1, cvShowImage(wndname,image); cvWaitKey(DELAY); cvInitFont( cvGetTextSize( “OpenCV forever!“, pt1.x = (width - text_size.width)/2; pt1.y = (height + text_size.height)/2; image2 = cvCloneImage(image); for( i = 0; i 255; i+ ) cvSubS( image2, cvScalarAll(i), image, 0 ); cvPutText( image, “OpenCV forever!“, pt1, cvShowImage(wndname,image); cvWaitKey(DELAY); / Wait for a key stroke; the same function arranges events processing cvWaitKey(0); cvReleaseImage( cvReleaseImage( cvDestroyWindow(wndname); return 0; 如上,已经完成所有配置,如果有特殊用途,需要调用到其他的 DLL 中的方法,请自 行在 bin 目录下,将相应 DLL 文件引用到项目中即可。 常见错误解决方案: 1、如遇错误提示:

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论