初学者,菜鸟一个什么都不会,请大侠们帮帮忙!
刚把环境安装好,但不知道怎么用它来运行程序,以下为例:请说明详细步骤,谢谢!// 例 2.5 图像的宽度和高度缩小一半
#include "stdafx.h"
#include <cv.h>
#include <highgui.h>
IplImage* doPyrDown(IplImage* in,int filter=IPL_GAUSSIAN_5x5)
{
//最好确保输入image分成两个
assert(in->width%2==0&&in->height%2==0);
IplImage* out=cvCreateImage(cvSize(in->width/2,in->height/2),in->depth,in->nChannels);
cvPyrDown(in,out);
return out;
};
int main(int argc, char** argv)
{
IplImage* img_in=cvLoadImage(argv[1]);
cvNamedWindow("example5",CV_WINDOW_AUTOSIZE);
cvShowImage("example5,img_in",img_in);
IplImage* img_out=doPyrDown(img_in,IPL_GAUSSIAN_5x5);
cvShowImage("example5,img_out",img_out);
cvWaitKey(0);
cvReleaseImage(&img_in);
cvDestroyWindow("example5");
return 0;
}
刚把环境安装好,但不知道怎么用它来运行程序,以下为例:请说明详细步骤,谢谢!// 例 2.5 图像的宽度和高度缩小一半
#include "stdafx.h"
#include <cv.h>
#include <highgui.h>
IplImage* doPyrDown(IplImage* in,int filter=IPL_GAUSSIAN_5x5)
{
//最好确保输入image分成两个
assert(in->width%2==0&&in->height%2==0);
IplImage* out=cvCreateImage(cvSize(in->width/2,in->height/2),in->depth,in->nChannels);
cvPyrDown(in,out);
return out;
};
int main(int argc, char** argv)
{
IplImage* img_in=cvLoadImage(argv[1]);
cvNamedWindow("example5",CV_WINDOW_AUTOSIZE);
cvShowImage("example5,img_in",img_in);
IplImage* img_out=doPyrDown(img_in,IPL_GAUSSIAN_5x5);
cvShowImage("example5,img_out",img_out);
cvWaitKey(0);
cvReleaseImage(&img_in);
cvDestroyWindow("example5");
return 0;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货