fastNlMeansDenoising() does not filter out noise

前端 未结 1 727

I am trying to remove noise by opencv fastNlMeansDenoising() function. But My output image is same like original noised image.

Input image:

<
1条回答
  •  攒了一身酷
    2021-01-05 22:37

    In OpenCV, the function is defined as follows

    void fastNlMeansDenoising(InputArray src, OutputArray dst, float h=3, int templateWindowSize=7, int searchWindowSize=21 )
    

    where

    Parameters: src – Input 8-bit 1-channel, 2-channel or 3-channel

    image. dst – Output image with the same size and type as src .

    templateWindowSize – Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels

    searchWindowSize – Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater

    searchWindowsSize - greater denoising time. Recommended value 21 pixels

    h – Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise

    Therefore, in order to remove noise, I had to increase the filter strength parameter h, big h value perfectly removes noise, but a smaller h value preserves details and also preserve some noise.

    So I perfectly removed the noise by using the function like this:

    fastNlMeansDenoising(img_gray, img1, 30.0, 7, 21);
    

    Output:

    Note: This function's execution time is too slow in debug mode. For a little bit faster execution time, better to run it in release mode.

    0 讨论(0)
提交回复
热议问题