I would like to share some denoising results using sparse modelling based on the SPAMS package. This was inspired by the topic of sparse modeling from the course ‘Image and video processing: From Mars to Hollywood with a stop at the hospital’ at Coursera. I highly recommend this course because it presents some state of the art methods in computer vision that I would have missed otherwise.
I was interested to see how well it would work on real noisy images so I found an old photo I took using a Canon Powershot S3 shot at night on 1600 ISO. Here is a 100% crop of the photo. As you can see, the noise is pretty awful!
Since there is a black sky in the background I thought it’ll be interesting to see what the noise distribution looks like. What do you know, it’s very Gaussian like! This is great because the square error formulation is well suited to this type of noise.
There are a few sparse model parameters one can fiddle around with, but in my experiement I’ve the kept the following fixed and only adjusted lambda since it seems to have the most pronounced effect
- K = 200, dictionary size (number of atoms)
- iterations = 100 – Ithink it’s used to optimize the dictionary + sparse vector
- patch size = 8 (8×8 patch)
- patch stride = 2 (skip every 2 pixels)
Here is with lambda = 0.1
lambda = 0.2
lambda = 0.9
It’s amazing how well it preserves the detail, especially the edges.
Python code can be downloaded here denoise.py_ (right click save as and remove the trailing _)