BM3D strange artifacts

asked 2019-09-19 10:21:27 -0500

cm7695 gravatar image

updated 2019-09-20 08:35:57 -0500

LBerger gravatar image


i tried the example bm3d_image_denoising.cpp with a grayscale picture in pgm format. The result is strange and has artifacts: there are lines visibile. I don't know what is wrong.

I started the program with the parameters ./bm3d_image_denoising -i=sample.pgm -sigma=55 -o=sample_out.pgm

I know the sigma is high but the problem is still visible for sigma 10 or 15 (but not so good). I sharpened the image and marked the lines with red arrow. Can someone help?


edit retag flag offensive close merge delete



You should add also the original image.

If you have Matlab, you can also test with the original implementation.

Eduardo gravatar imageEduardo ( 2019-09-19 17:32:35 -0500 )edit

Here is the original image:


I don't own matlab. But I know the implementation of Marc Lebrun in

This implementation produces


cm7695 gravatar imagecm7695 ( 2019-09-20 08:15:39 -0500 )edit

I don't undestand using opencv-4.1.2 results is : image description

LBerger gravatar imageLBerger ( 2019-09-20 08:41:46 -0500 )edit

You have this problem too. If you sharpen your image, you can see it clearly:


cm7695 gravatar imagecm7695 ( 2019-09-20 09:46:30 -0500 )edit

If you sharpen image, how do you sharpen this image?

LBerger gravatar imageLBerger ( 2019-09-20 10:48:32 -0500 )edit

If I sharpen an image, it depends on what i want to see. But in this case, i only sharpened the image, such that everybody can see the artifacts. I applied with gimp an inverse diffusion filter with gmic. But it works with an unsharp mask too. Or with a filter of your choice. For example with a deblur filter


One can see this also without sharpening on good monitors.

cm7695 gravatar imagecm7695 ( 2019-09-20 13:00:49 -0500 )edit

Maybe an issue in the OpenCV implementation.

If you are lucky, the IPOL and the OpenCV implementations follow strictly the original Matlab code. To debug, input a dummy matrix and compare the outputs at different steps of the two implementations to find the discrepancy.

Eduardo gravatar imageEduardo ( 2019-09-20 17:07:51 -0500 )edit