《学习opencv》第五章课后习题2

// 5-2.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include<opencv/cv.h>
#include<opencv/highgui.h>

int _tmain(int argc, _TCHAR* argv[])
{
	IplImage* img=cvCreateImage(cvSize(200,200),IPL_DEPTH_8U,1);
	IplImage* dst1=cvCreateImage(cvSize(200,200),IPL_DEPTH_8U,1);
	IplImage* dst2=cvCreateImage(cvSize(200,200),IPL_DEPTH_8U,1);
	IplImage* dst3=cvCreateImage(cvSize(200,200),IPL_DEPTH_8U,1);
	cvZero(img);
	/*int step = img->widthStep/sizeof(uchar);
    uchar* data = (uchar *)img->imageData;
    data[100*step+100] = 255;*/
	cvSet2D(img,50,50,255);
    cvSmooth(img,dst1,CV_GAUSSIAN,5,0,0,0);
	cvSmooth(dst1,dst2,CV_GAUSSIAN,5,0,0,0);
    cvSmooth(img,dst3,CV_GAUSSIAN,9,0,0,0);

	cvNamedWindow("original",1);
	cvNamedWindow("1*5Result",1);
    cvNamedWindow("2*5Result",1);
	cvNamedWindow("1*9Result",1);

	cvShowImage("original",img);
	cvShowImage("1*5Result",dst1);
	cvShowImage("2*5Result",dst2);
	cvShowImage("1*9Result",dst3);
	cvWaitKey(0);
	cvDestroyAllWindows();
	cvReleaseImage(&img);
	cvReleaseImage(&dst1);
	cvReleaseImage(&dst2);
	cvReleaseImage(&dst3);
	return 0;
}


 

你可能感兴趣的:(DST)