我想写一个维纳滤镜来改善图像。我不想使用傅立叶,我知道有一个基于中位数和方差的算法,但我找不到它。你能帮我吗?
http://en.wikipedia.org/wiki/Wiener_filter
最佳答案
I think this is what you are looking for.该代码由Ray Juang编写。
使用上述代码的示例
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);
}