I am looking for a strong baseline in image denoising and therefore wanted to have the BM3D algorithm in my benchmark.

These 2 python implementations:

have been unmaintained for a long time (and the second one is documented in what I think is chinese). I have experimented a bit with the first one without satisfactory results (see https://github.com/ericmjonas/pybm3d/issues/11 with non satisfactory fixes like clipping).

This package : https://pypi.org/project/bm3d/#description , doesn't have a documentation or source code easily findable.

Then I found this: https://docs.opencv.org/master/de/daa/group__xphoto.html#ga2fc5a9661c1338a823fb3290673a880d, in the docs of opencv but there is no indication as to how to use it and no examples in python. I saw this SO question but it's for a C++ implementation and I don't know how it would translate in Python because I am not familiar at all with opencv.

  • $\begingroup$ Have you found something? $\endgroup$ – David Nov 26 '19 at 11:54
  • $\begingroup$ @David see the answer below $\endgroup$ – Zaccharie Ramzi Nov 26 '19 at 13:08

What I resorted to was using the pypi package, which is advertised here: http://www.cs.tut.fi/~foi/GCF-BM3D/index.html#ref_software .

I digged a bit in the source code, and found that I could perform BM3D, in the following fashion:

import bm3d

denoised_image = bm3d.bm3d(image_noisy + 0.5, sigma_psd=30/255, stage_arg=bm3d.BM3DStages.HARD_THRESHOLDING)

I installed bm3d using pip (pip install bm3d) and needed OpenBlas (sudo apt-get install libopenblas-dev).

I kept the + 0.5 to show that it didn't work well using images with negative values. I also haven't spent much time trying to tune the different parameters available. This is unsatisfying as I guess it still performs some kind of clipping of the negative values to 0, but at least it's a good first approximation.

  • $\begingroup$ While this solution works, it doesn't implement the full bm3d algorithm, which is more powerful when used with stage_arg=bm3d.BM3DStages.ALL_STAGES. It is however twice slower with all stages. $\endgroup$ – Zaccharie Ramzi Nov 26 '19 at 16:45
  • $\begingroup$ Just as a confirmation, this method allows me to reproduce the results of arxiv.org/pdf/1902.02452.pdf (Table 1) and arxiv.org/pdf/1608.03981.pdf (Table 2) on the BSD68 dataset in terms of PSNR. $\endgroup$ – Zaccharie Ramzi Nov 27 '19 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.