[转] OPENCV2.2与VS2010配置

mac2022-06-30  118

原文地址: http://www.cnblogs.com/djcsch2001/archive/2011/04/04/2005450.html

 

OPENCV是INTEL公司开发的一套计算机视觉处理软件,可以对图形图像进行多功能的处理,下面是其在WINDOWS的安装步骤

1.直接下载opencv2.2 for vs2010的安装版进行安装(下载网址:http://www.opencv.org.cn/index.php/Download)

2.如果安装到目录D:\OpenCV2.2,则在系统的PATH下加入路径D:\OpenCV2.2

3.在VS2010下新建一个visual c++的空项目,在项目的属性设置中,设置vc++目录的包含目录加入D:\OpenCV2.2\include

   和D:\OpenCV2.2\include\opencv;库目录加入D:\OpenCV2.2\lib;

4.链接器加入附加依赖库(Debug的库带d,如opencv_core220d.dll,而Release则不含d,如opencv_core220.dll)

D:\OpenCV2.2\lib\opencv_core220d.libD:\OpenCV2.2\lib\opencv_calib3d220d.libD:\OpenCV2.2\lib\opencv_contrib220d.libD:\OpenCV2.2\lib\opencv_features2d220d.libD:\OpenCV2.2\lib\opencv_ffmpeg220d.libD:\OpenCV2.2\lib\opencv_flann220d.libD:\OpenCV2.2\lib\opencv_gpu220d.libD:\OpenCV2.2\lib\opencv_highgui220d.libD:\OpenCV2.2\lib\opencv_imgproc220d.libD:\OpenCV2.2\lib\opencv_legacy220d.libD:\OpenCV2.2\lib\opencv_ml220d.libD:\OpenCV2.2\lib\opencv_objdetect220d.libD:\OpenCV2.2\lib\opencv_video220d.lib

5.添加一CPP文件

#include "cv.h"#include "highgui.h"#include "math.h"

int main(){ IplImage* src; /* the first command line parameter must be image file name */ if((src = cvLoadImage("D:\\baboon.jpg"))!=0) {  IplImage* dst = cvCloneImage( src );  int delta = 1;  int angle = 0;

  cvNamedWindow( "src", 1 );  cvShowImage( "src", src );

  for(;;)  {   float m[6];   double factor = (cos(angle*CV_PI/180.) + 1.1)*3;   CvMat M = cvMat( 2, 3, CV_32F, m );   int w = src->width;   int h = src->height;

   m[0] = (float)(factor*cos(-angle*2*CV_PI/180.));   m[1] = (float)(factor*sin(-angle*2*CV_PI/180.));   m[2] = w*0.5f;   m[3] = -m[1];   m[4] = m[0];   m[5] = h*0.5f;

   cvGetQuadrangleSubPix(src, dst, &M);

   cvNamedWindow( "dst", 1 );   cvShowImage( "dst", dst );

   if( cvWaitKey(5) == 27 )    break;

   angle = (angle + delta) % 360;  } } return 0;}

运行为一不停旋转的图像,至此配置成功!

转载于:https://www.cnblogs.com/PierreDelatour/archive/2011/12/02/2272034.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)