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, 2019 at 11:54
  • $\begingroup$ @David see the answer below $\endgroup$ Nov 26, 2019 at 13:08

2 Answers 2


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 dug 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, sigma_psd=30/255, stage_arg=bm3d.BM3DStages.HARD_THRESHOLDING)

There are also some examples in the library's source code download.

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


If you don't want to use the PyPI package for bm3d, you can use ffmpeg and run the bm3d filter as an OS command-

command="ffmpeg -i "+input_image_path+" -filter_complex bm3d=sigma=30/255:block=4:bstep=2:group=1:hdthr=10000:estim=basic /path/to/output/directory/output.png"    

This takes lesser computation time.


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.