ericmjonas/pybm3d

Noise standard deviation

Opened this issue · 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

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?

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.

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!

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?