本文介绍了维纳滤波的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个维纳滤镜来改善图像。我不想使用傅里叶变换,我知道有一个中值和方差为基础的ALG,但我找不到它。你能帮助我吗?

解决方案

我想这就是你要找的。这段代码是由Ray Juang编写的。



使用上面的代码的例子

pre $ void $(main argc, char * argv [])
if(argc printf(Usage:%s< image> \\\
,argv [0]);
return;
}

IplImage * tmp = cvLoadImage(argv [1]);
IplImage * tmp2 = cvCreateImage(cvSize(tmp-> width,tmp-> height),IPL_DEPTH_8U,1);

cvCvtColor(tmp,tmp2,CV_RGB2GRAY);

cvNamedWindow(Before);
cvShowImage(Before,tmp);

cvWiener2(tmp2,tmp2,3,3);
cvNamedWindow(After);

cvShowImage(After,tmp2);
//cvSaveImage(\"C:/temp/result.png,tmp2);
cvWaitKey(-1);


cvReleaseImage(& tmp);
cvReleaseImage(& tmp2);
}


I want to write a Wiener filter to improve an image. I don't want to use fourier, i know there is a median and variance based alg, but i can't find it. Can you help me guys?http://en.wikipedia.org/wiki/Wiener_filter

解决方案

I think this is what you are looking for. This code is written by Ray Juang.

example on using above code

void main(int argc, char *argv[])
    if (argc <= 1) {
            printf("Usage: %s <image>\n", argv[0]);
            return;
        }

    IplImage *tmp = cvLoadImage(argv[1]);
    IplImage *tmp2 = cvCreateImage(cvSize(tmp->width, tmp->height), IPL_DEPTH_8U, 1);

    cvCvtColor(tmp, tmp2, CV_RGB2GRAY);

    cvNamedWindow("Before");
    cvShowImage("Before", tmp);

    cvWiener2(tmp2, tmp2, 3,3);
    cvNamedWindow("After");

    cvShowImage("After", tmp2);
    //cvSaveImage("C:/temp/result.png", tmp2);
    cvWaitKey(-1);


    cvReleaseImage(&tmp);
    cvReleaseImage(&tmp2);
}

这篇关于维纳滤波的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 23:04