在VS2010平台上配置OPENCV2.3.0(截图).doc

上传人:s9****2 文档编号:551599687 上传时间:2023-11-19 格式:DOC 页数:10 大小:462KB
返回 下载 相关 举报
在VS2010平台上配置OPENCV2.3.0(截图).doc_第1页
第1页 / 共10页
在VS2010平台上配置OPENCV2.3.0(截图).doc_第2页
第2页 / 共10页
在VS2010平台上配置OPENCV2.3.0(截图).doc_第3页
第3页 / 共10页
在VS2010平台上配置OPENCV2.3.0(截图).doc_第4页
第4页 / 共10页
在VS2010平台上配置OPENCV2.3.0(截图).doc_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《在VS2010平台上配置OPENCV2.3.0(截图).doc》由会员分享,可在线阅读,更多相关《在VS2010平台上配置OPENCV2.3.0(截图).doc(10页珍藏版)》请在金锄头文库上搜索。

1、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)http:/ 2、安装解压到E盘根目录下。(位置随便,不过下面的path需要根据实际情况自行修改了。) 3、设置系统环境变量我的电脑右键“属性”,选择“高级”,点“环境变量”在用户变量处

2、,新建PATH和OPENCV两个项:PATH (只需添加下面中的一行,根据系统情况自行选择)E:OpenCV2.3buildx86vc10binOPENCVE:OpenCV2.3build 配置好后一定要重启电脑,不然之后运行会出错(好像是说缺少什么文件来着)4、打开VS2010 新建一个项目(OPENCVTEST),然后如图单击右键,选属性(1)点击VC+目录,在右边配置包含目录和库目录(注。配置(C)下拉框中,建议选择所有配置,这样Debug运行,Release运行就都可以了)包含目录:E:OpenCV2.3buildincludeE:OpenCV2.3buildincludeopencv

3、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”)-

4、“配置属性”-“链接器”-“输入”-“附加依赖库”中追加下面一行(包括所有分号,勿删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

5、的?图?像?绘?制?功|能*/#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;

6、 / 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*

7、 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 - wi

8、dth; 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(&r

9、ng) % 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;

10、 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,

11、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=cvRandI

12、nt(&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,

13、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) % wi

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号