simulated-annealing-denoising
simulated-annealing-denoising copied to clipboard
Binary image denoising using MRF, Ising model, and simulated annealing.
##Dependencies
- pillow
- Numpy
- matplotlib
The source code can be run under windows or linux with python 2.7+ and the libraries above.
##Directory structure
./
├── doc
│ └── report.pdf (the report)
├── img
│ ├── best.png (SA-denoised result)
│ ├── flipped.png (flipped image)
│ ├── ICM-energy-time.png (time-energy plot of ICM)
│ ├── icm.png (ICM-denoised result)
│ ├── in.png (original image)
│ └── SA-energy-time.png (time-energy plot of SA)
└── src
├── binarize.py (script to convert the input to a binary image)
├── count.py (script to evaluate the denoised results)
├── denoise.py (script to denoise the results with either SA or ICM)
├── flip.py (script to flip the image)
└── util.py (utilities. Configurable arguments are defined here.)
##How to generate the results
Note: python scripts should be run under the src directory. All images will be placed under the img directory.
- Place the original image called
in.pngunderimgdirectory. - Enter the
srcdirectory, runpython binarize.py. It will convert thein.pngto a binary image and overwrite it. - Run
python flip.py, which will generate the flipped image namedflipped.png. - Run
python denoise.pyto denoise the flipped image using simulated annealing. The result will be namedbest.png. Temporary results (temp-*.png) and the time-energy plot (SA-energy-time.png) will be saved, too. - Run
python denoise.py -m "ICM" -o "icm.png"to denoise the flipped image using ICM. The result will be namedicm.png. Temporary results (icm-temp-*.png) and the time-energy plot (ICM-energy-time.png) will be saved, too. - Run
python count.pyto see how many pixels of the output of SA agree to the original image. To do the same evaluation for ICM, runpython count.py -o "icm.png"
You can run python denoise.py -h to see what arguments are configurable.
##About
- Github repository
- Time: Nov. 2014