Execute NL-means for each RGB channel

I noticed some precautions when removing noise from color images with NL-Means (NLM). When I removed noise from the photos of Shuzenji Sakura and White-eye with fastNLMeansDenoigingColored () of OpenCV2, the color of the petals and staves of the cherry blossoms flew away.

I thought about the cause, but probably inside fastNLMeansDenoigingColored, after converting RGB to luminance value (L), calculate the similarity between patches and smooth with a common weight for all RGB channels. I thought it might be. As a result, it is probable that the color of the petals and staves was not reflected so much in the calculation of the similarity between the patches, and the color faded.

Therefore, I wondered if this problem could be avoided by applying NLM independently to each RGB channel, and experimented.

fig.png

By applying NLM for each color channel, you can see that noise can be removed while preserving the color of petals and staves.

The source code is below. https://github.com/kibo35/restoration/blob/master/NLM/nlm_for_each_color.py

(Addition) Thank you for pointing out, Mr. ktgw0316. We have confirmed that the debugged code solves the fading problem.

The image after processing with fastNLMeansDenoigingColored seemed to fade because the second argument dst was missing.

Recommended Posts

Execute NL-means for each RGB channel
Switch PYTHONPATH for each virtualenv