#include "cv.h"
#include "highgui.h"
#include <stdio.h>
int main(int argc,char **argv)
{
IplImage *src=/blog.armyourlife.info/0,*dst=0,*dst2=0;
float k[9]={
1.f/16,2.f/16,1.f/16,
2.f/16,4.f/16,2.f/16,
1.f/16,2.f/16,1.f/16};
CvMat Km;
Km = cvMat(3,3,CV_32F,k);
src=/blog.armyourlife.info/cvLoadImage("lena.jpg",0);//Force to gray image
dst=cvCloneImage(src);
cvNamedWindow("src",0);
cvShowImage("src",src);
cvNamedWindow("filtering",0);
cvFilter2D(src,dst,&Km,cvPoint(-1,-1));
cvShowImage("filtering",dst);
cvWaitKey(0);
cvReleaseImage(&src);
cvReleaseImage(&dst);
return 0;
}
本文转自gnuhpc博客园博客,原文链接:http://www.cnblogs.com/gnuhpc/archive/2012/11/25/2787601.html,如需转载请自行联系原作者