在VS2010平台上配置OPENCV2.3.0(截图).doc_第1页
在VS2010平台上配置OPENCV2.3.0(截图).doc_第2页
在VS2010平台上配置OPENCV2.3.0(截图).doc_第3页
在VS2010平台上配置OPENCV2.3.0(截图).doc_第4页
在VS2010平台上配置OPENCV2.3.0(截图).doc_第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.3buildx86vc10binOPENCVE:OpenCV2.3build 配置好后一定要重启电脑,不然之后运行会出错(好像是说缺少什么文件来着)4、打开VS2010 新建一个项目(OPENCVTEST),然后如图单击右键,选属性(1)点击VC+目录,在右边配置包含目录和库目录(注。配置(C)下拉框中,建议选择所有配置,这样Debug运行,Release运行就都可以了)包含目录:E:OpenCV2.3buildincludeE:OpenCV2.3buildincludeopencvE: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_ml230.lib;opencv_legacy230.lib;opencv_imgproc230.lib 5,。完成以后就可以跑一个小程序试试啦(1)右击源文件,添加新项,选C+文件,随便取个名(2)将下面代码复制上去,F5执行,希望这个程序能让你爱上OPENCV/* 程序名?:odrawing.c功|能:o展1示?OpenCV的?图?像?绘?制?功|能*/#include cv.h#include highgui.h#include #include #define NUMBER 100#define DELAY 5char wndname = Drawing Demo;CvScalar random_color(CvRNG* rng) int icolor = cvRandInt(rng); return CV_RGB(icolor&255, (icolor8)&255, (icolor16)&255);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 = &(ptt0); pt1 = &(ptt3); arr0 = 3; arr1 = 3; for (i = 0; i NUMBER; i+) pt1.x=cvRandInt(&rng) % width3 - width; pt1.y=cvRandInt(&rng) % height3 - height; pt2.x=cvRandInt(&rng) % width3 - width; pt2.y=cvRandInt(&rng) % height3 - height; cvLine( image, pt1, pt2, random_color(&rng), cvRandInt(&rng)%10, line_type, 0 ); cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt1.x=cvRandInt(&rng) % width3 - width; pt1.y=cvRandInt(&rng) % height3 - height; pt2.x=cvRandInt(&rng) % width3 - width; pt2.y=cvRandInt(&rng) % height3 - height; cvRectangle( image,pt1, pt2, random_color(&rng), cvRandInt(&rng)%10-1, line_type, 0 ); cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt1.x=cvRandInt(&rng) % width3 - width; pt1.y=cvRandInt(&rng) % height3 - height; sz.width =cvRandInt(&rng)%200; sz.height=cvRandInt(&rng)%200; angle = (cvRandInt(&rng)%1000)*0.180; cvEllipse( image, pt1, sz, angle, angle - 100, angle + 200, random_color(&rng), cvRandInt(&rng)%10-1, line_type, 0 ); cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt00.x=cvRandInt(&rng) % width3 - width; pt00.y=cvRandInt(&rng) % height3 - height; pt01.x=cvRandInt(&rng) % width3 - width; pt01.y=cvRandInt(&rng) % height3 - height; pt02.x=cvRandInt(&rng) % width3 - width; pt02.y=cvRandInt(&rng) % height3 - height; pt10.x=cvRandInt(&rng) % width3 - width; pt10.y=cvRandInt(&rng) % height3 - height; pt11.x=cvRandInt(&rng) % width3 - width; pt11.y=cvRandInt(&rng) % height3 - height; pt12.x=cvRandInt(&rng) % width3 - width; pt12.y=cvRandInt(&rng) % height3 - height; cvPolyLine( image, pt, arr, 2, 1, random_color(&rng), cvRandInt(&rng)%10, line_type, 0 ); cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt00.x=cvRandInt(&rng) % width3 - width; pt00.y=cvRandInt(&rng) % height3 - height; pt01.x=cvRandInt(&rng) % width3 - width; pt01.y=cvRandInt(&rng) % height3 - height; pt02.x=cvRandInt(&rng) % width3 - width; pt02.y=cvRandInt(&rng) % height3 - height; pt10.x=cvRandInt(&rng) % width3 - width; pt10.y=cvRandInt(&rng) % height3 - height; pt11.x=cvRandInt(&rng) % width3 - width; pt11.y=cvRandInt(&rng) % height3 - height; pt12.x=cvRandInt(&rng) % width3 - width; pt12.y=cvRandInt(&rng) % height3 - height; cvFillPoly( image, pt, arr, 2, random_color(&rng), line_type, 0 ); cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 0; i NUMBER; i+) pt1.x=cvRandInt(&rng) % width3 - width; pt1.y=cvRandInt(&rng) % height3 - height; cvCircle( image, pt1, cvRandInt(&rng)%300, random_color(&rng), cvRandInt(&rng)%10-1, line_type, 0 ); cvShowImage(wndname,image); cvWaitKey(DELAY); for (i = 1; i NUMBER; i+) pt1.x=cvRandInt(&rng) % width3 - width; pt1.y=cvRandInt(&rng) % height3 - height; cvInitFont( &font, cvRandInt(&rng) % 8,(cvRandInt(&rng)%100)*0.05+0.1, (cvRandInt(&rng)%100)*0.05+0.1, (cvRandInt(&rng)%5)*0.1, cvRound(cvRandInt(&rng)%10), line_type ); cvPutText( image, Testing text rendering!, pt1, &font, random_color(&rng); cvShowImage(wndname,image); cvWaitKey(DELAY); cvInitFont( &font, CV_FONT_HERSHEY_COMPLEX, 3, 3, 0.0, 5, line_type ); cvGetTextSize( OpenCV forever!, &font, &text_size, &ymin ); 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, &font, CV_RGB(255,i,i); cvShowImage(wndname,image); cvWaitKey(DELAY); / Wait for a key stroke; the same function arranges events processing cvWaitKey(0); cvReleaseImage(&image); cvReleaseImage(&image2); cvDestroyWindow(wndname);return

温馨提示

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

评论

0/150

提交评论