pybm3d icon indicating copy to clipboard operation
pybm3d copied to clipboard

Noise standard deviation

Open sandeepnmenon opened this issue 8 years ago • 4 comments

When using the bm3d function, it asks for standard deviation of noise out = pybm3d.bm3d.bm3d(noisy_img, noise_std_dev)`

Bm3d can also work without knowing the standard deviation of the noise How to use the function without having to give nois_std_dev

sandeepnmenon avatar Nov 01 '17 05:11 sandeepnmenon

The core C implementation of BM3D we are currently using (see here) always needs a specific standard deviation of the noise. Do you know any C implementation or resource that shows how BM3D works without specifying the standard deviation?

timmeinhardt avatar Nov 03 '17 10:11 timmeinhardt

The .mex file that the finnish group provides has a Wiener filter function which estimates the noise. A quick search in google gave an Adaptive Wiener Filter implementation in C++ https://github.com/prittt/AdaptiveWienerFilter

On a side note, I was about to post it as an additional issue: If one provides a 0 input for noise_std, the bm3d does indeed returns a different image (used np.linalg.norm). In the matlab implementation if one inputs 0 it estimates the noise using a Wiener filter as mentioned above, but since there is none implemented in our case, it raises a red flag.

paggers avatar Nov 04 '17 18:11 paggers

This would indeed be a great addition. Unfortunately the Adaptive Wiener Filter implementation you provided heavily relies on OpenCV which would introduce a huge new dependency. I will think about a reimplementation which then can be added to the C core repository I mentioned above.

For now one could easily use the estimate_sigma function provided by skimage. I am not sure of of the exact differences between their wavelet and the Wiener filter approach.

I will also look into the case of noise_std equal to 0. Thank you again for your feedback!

timmeinhardt avatar Nov 04 '17 19:11 timmeinhardt

Sometimes, when given an input with noise, the output of bm3d consists of some np.nan values. I wonder is there any operation that can possibly cause np.nan?

yuehniu avatar Apr 05 '19 03:04 yuehniu