I just found this very well put together site about using the discrete cosine transform (DCT) to do threshold de-noising in a manner similar to the wavelet threshold denoising and sharpening I mentioned before.
DCT Denoising
Very slick, complete with well formatted mathematics that puts most microsoft-word based papers to shame, GPL3 source and on-line demo!
I downloaded the code and modified it not to add the noise and tried it myself on Lenna:
The results are effectively the same as with the complex DTCWT version for moderate settings - visually even the artefacts it introduces are the same.
In the form provided however it is somewhat more computationally intensive - it's sliding window is offset by single pixels, and the way the C++ is written isn't the most efficient. I wonder how well it would work with a hanning window and 4 pixel offsets. I wonder if it can also sharpen - from a quick search it looks like it can.
Very interesting, and it also works with colour images in smarter ways than just processing each channel separately.
When I get the time I'll look at coding this up for ImageZ and socles,
Update: Just another advert for Java. It looked simple enough so I coded up a version in Java using an 8x8 DCT and it runs single-threaded over 3x faster than the C++ version, including the JVM startup or over 4x once it's going. Rather than generate all 255 025(!) patches, transform, threshold, inverse, and merge, it fully processes a single patch each time: requiring that much less DCT memory (i.e. rather a lot - over 62MB less). So that's 0.9s vs 3.9s for this 512x512 mono image. Although I can't fathom why my version needs 1/2 the threshold to give a similar result ...
Update: See follow-on post where i mention implementing it in OpenCL for socles.
Update: I've now added it to ImageZ. DCT8Denoise is the main entry point. I changed it to work with separate colour planes rather than planes stored in a single array, just to make it easier to invoke from ImageZ. It's only single-threaded atm.
2 comments:
Hi,
Could you release your Java implementation? This could help the authors of the IPOL article improve their code.
It's mostly just a fairly obvious re-arranging of the memory use: e.g. their current code generates all tiles, processes all tiles, merges all results: when i just do all the work on each tile before extracting the next one, only the result normalisation is done across the whole image.
I'll probably end up dropping it into ImageZ at some point (probably soon), but if anyone wants to discuss it i suggest the socles mailing list.
Post a Comment