Skip to content

This repository adds noise to an image by performing color transfer and recovery between two images, then calculates PSNR between two images.

Notifications You must be signed in to change notification settings

chia56028/PSNR-Calculator-for-Images

Repository files navigation

PSNR-Calculator-for-Images

This program written in python can calculate Peak Signal-to-noise-ratio between two images.

Features

  • Add noise to an image by performing color transfer and recovery between two images
  • Calculate PSNR between two images

Details

First let us add noise to an image by performing color transfer and recovery between two images. Of course you can just jump this step if already having your own images. Last week I had already implemented color transfer in another repository. After understanding the principle of color transfer, we can perform color recovery by changing the formula.

After completing the above steps, it's time to calculate PSNR between two images. Just split a color image into its 3 RGB channels then calculate their MSE and use it to calculate PSNR.

MAXI is maximum value of pixel, actually it will be 255.

Install Packages

pip install numpy
pip install opencv-python
pip install python-csv

If you want to create EXE file after programming, also install this:

pip install pyinstaller

Run the program

Put 6 source pictures inside source folder and 6 target pictures inside the target folder, then execute the code:

python color_transfer_and recovery.py

After that, your can find 6 result images inside result folder and 6 recovery images inside result folder.

Then, execute the command below to get PSNR between source images and recovery images:

python calculate_PSNR.py

Execute following instruction to create EXE file of this program:

pyinstaller -F color_transfer.py

Example

Source / Recovery

The PSNR between these two images is 43.71 :)

About

This repository adds noise to an image by performing color transfer and recovery between two images, then calculates PSNR between two images.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages