#include <opencv2/highgui/highgui.hpp>
#include <cv.h>
using namespace std;
using namespace cv;
IplImage *dopyrDown(IplImage *in,int filter = IPL_GAUSSIAN_5x5)
{
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;
}
void main()
{
IplImage *image = cvLoadImage("D:\\1.png");
cvNamedWindow("example4-in");
cvNamedWindow("example4-out");
cvShowImage("example4-in",image);
cvShowImage("example4-pyrdown",dopyrDown(image));
//imshow("example4-in",image);
//Mat out = cvCreateImage(cvGetSize(&image),IPL_DEPTH_8U,3);
IplImage *out = cvCreateImage(cvGetSize(image),IPL_DEPTH_8U,3);
cvSmooth(image,out,CV_GAUSSIAN,3,3,0,0);//高斯平滑
cvShowImage("example4-out",out);
cvReleaseImage(&out);
waitKey(0);
cvDestroyAllWindows();
system("pause");
}
opencv 学习第二天 学习opencv(中文版)对一幅图片进行高斯平滑并缩小一半
最新推荐文章于 2019-06-04 23:26:09 发布