Wiener filtering
I want to write a Wiener fil开发者_JS百科ter 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);
}
精彩评论