【OpenCV學習】影象卷積濾波

weixin_33860553發表於2012-11-25

作者:gnuhpc
出處:http://www.cnblogs.com/gnuhpc/

 
#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/

相關文章