HomeOfVapourSynthEvolution / VapourSynth-BM3D

BM3D denoising filter for VapourSynth
MIT License
116 stars 31 forks source link

Algorithm in basic and final estimate #18

Open xiongjj opened 8 years ago

xiongjj commented 8 years ago

Hi, Mawen. I am learning on bm3d denoising algorithm based on this. I've already forked on you bm3d project and it was really good work. I wanted to know that you implemented VapourSynth-BM3D on your own method or according to this paper?

Thanks for you help!

mawen1250 commented 8 years ago

Of course I've read the paper (which is the origin of BM3D). I implemented the algorithm mostly according to it and its successors, like C-BM3D and V-BM3D. For convenience I didn't implement some parts of it. For example I used DCT for all transformations.

xiongjj commented 8 years ago

Thanks for your reply. The original of BM3D used bior1.5 in the basic estimate and dct in the final estimate. Have you compared the performance(PSNR) of your implementation with the original BM3D matlab code? I have got another implementation with c++ from IPOL and the performance is not as well as the original one.

mawen1250 commented 8 years ago

I've also read the paper from IPOL. It has compared the performance between different transformations, PSNR is about 0.5dB lower when all the transformations are DCT. I've tested different parameters with the MATLAB code. I compared them both by PSNR and visually. Based on the results, I implemented my own BM3D with some simplifications. There can be differences between it and the MATLAB one, but visually I can't tell which one is better.

xiongjj commented 8 years ago

Have you ever tried the original idea with bior 1.5 transformation in the basic estimate and dct transformation in the final estimate? 0.5dB lower on PSNR cannot be acceptable, so I want to get the same performance as the original BM3D on PSNR. The algorithm from IPOL implemented the original idea but PSNR still got 0.2dB lower than original matlab code. Thanks for your kind reply.

mawen1250 commented 8 years ago

The reasons I chose DCT for all the transformations:

  1. I've tried it in the MATLAB code, the visual difference between them is acceptable (actually I can't tell which is better).
  2. Obviously it's more convenient, and probably more efficient. Since I can just use FFTW3 to do the 3D transformation all at the same time, and FFTW3 can find a better routine to optimize it.
  3. Bior 1.5 transformation limits block_size to power2.
  4. According to those papers, the reason to use different transformations in basic and final is to avoid the artifacts produced in basic estimate being brought into final estimate. I found an alternative way to (partially) solve this, in all the profile, block_step in final estimate is smaller than the one in basic estimate. In my test, it can significantly increase the visual quality, producing much less artifacts.

Anyway, using the transformations suggested by the original paper might be a better choice, but I don't find it neccessary. If there's something I can improve, I think it's the implementation of DCT. FFTW3 implements DCT by transferring it to DFT, which obviously is slower than implementing DCT directly.

xiongjj commented 8 years ago

I have a few question for this paper. Please help me if you know it. Thank you very much!