Structural Similarity (SSIM) index, where the core dependency is NumPy
To actually compare images with SSIM-py Pillow or opencv-python is needed
- Download the SSIM-py.zip
- Setup and activate a virtual environment (optional)
- Extract the requirements.txt from the downloaded SSIM-py.zip
- Open a command-line interface
- Enter the following command on the command-line
pip install -r requirements.txt
Result: Pillow, opencv-python and numpy modules are installed in the environment.
Have two similar images ready to compare.
For the best result:
The module: opencv-python is preferred.
Make sure both images are the same size and have the same amount of color channels
- Open a command-line interface
- Read the help text by entering the following command
python SSIM-py.zip --help
(optional) - Enter the following command
python SSIM-py.zip path/to/image1 path/to/image2
Result: Number between 1 and 0 shows up on the command-line.
Run the command again but now with the --verbose
argument.
Copy the log into an textfile.
Usefull command to do this with is: python SSIM-py.zip --verbose path/to/image1 path/to/image2 > SSIM-py.log
Create an issue with the SSIM-py.log and the images used.
Created and tested on Ubuntu 18.04.3 LTS
With python 3.6.8 (default, Oct 7 2019, 12:59:55) [GCC 8.3.0]
Pillow: 6.2.0
numpy: 1.17.3
opencv_python: 4.1.1.26
Tested with the following image formats: .tif .png .ppm .pgm .jpg .bmp
CAUTION: Comparing the same images with different file formats with Pillow won't give expected results.
Thanks mom, Thanks dad.