Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wiener filtering

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

like image 383
tracius01 Avatar asked Jul 02 '11 17:07

tracius01


1 Answers

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);
}
like image 94
Niroshan Avatar answered Sep 26 '22 08:09

Niroshan