Python implementation of SSIMULACRA2 image quality metric
Project description
SSIMULACRA2
Python implementation of SSIMULACRA2 (Structural SIMilarity Unveiling Local And Compression Related Artifacts) - a perceptual image quality metric designed to accurately detect compression artifacts.
Description
SSIMULACRA2 is a full-reference image quality metric that aims to estimate human perception of image quality, specifically focusing on compression artifacts. This Python package provides a clean, efficient implementation that closely follows the original C++ algorithm.
SSIMULACRA2 scores range from 100 (perfect quality) down to negative values (extremely poor quality):
- negative scores: extremely low quality, very strong distortion
- 10: very low quality (average output of cjxl -d 14 / -q 12 or libjpeg-turbo quality 14, 4:2:0)
- 30: low quality (average output of cjxl -d 9 / -q 20 or libjpeg-turbo quality 20, 4:2:0)
- 50: medium quality (average output of cjxl -d 5 / -q 45 or libjpeg-turbo quality 35, 4:2:0)
- 70: high quality (hard to notice artifacts without comparison to the original)
- 80: very high quality (impossible to distinguish from the original in a side-by-side comparison at 1:1)
- 85: excellent quality (impossible to distinguish from the original in a flip test at 1:1)
- 90: visually lossless (impossible to distinguish from the original in a flicker test at 1:1)
- 100: mathematically lossless
Installation
pip install ssimulacra2
Usage
Command Line
# Basic usage
ssimulacra2 original.png compressed.png
# For just the score without interpretation
ssimulacra2 original.png compressed.png --quiet
Python
from ssimulacra2 import compute_ssimulacra2, compute_ssimulacra2_with_alpha
# Basic usage
score = compute_ssimulacra2("original.png", "compressed.png")
print(f"Quality score: {score:.2f}")
# For images with alpha channel (automatically uses both dark and light backgrounds)
score = compute_ssimulacra2_with_alpha("original.png", "compressed.png")
print(f"Quality score with alpha: {score:.2f}")
Features
- Accurate: Closely follows the original C++ implementation
- Alpha Support: Special handling for images with transparency
- Multi-scale Analysis: Examines image quality at multiple resolution scales
- XYB Color Space: Uses a perceptual color space for more accurate results
- Easy to Use: Simple command-line interface and Python API
Requirements
- Python 3.8+
- NumPy
- SciPy
- Pillow (PIL)
- scikit-image
- OpenCV
Performances
Size : 1024x768
v0.2.0
Time (mean ± σ): 671.5 ms ± 8.2 ms [User: 566.1 ms, System: 100.2 ms]
Range (min … max): 659.6 ms … 683.4 ms 10 runs
v0.1.0
Time (mean ± σ): 22.447 s ± 0.197 s [User: 22.263 s, System: 0.069 s]
Range (min … max): 22.186 s … 22.723 s 10 runs
License
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
Acknowledgements
This implementation is based on the original SSIMULACRA2 algorithm developed for the JPEG XL project.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ssimulacra2-0.2.0.tar.gz.
File metadata
- Download URL: ssimulacra2-0.2.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
462edc71c6bfcbdd3517d3187f5320144d6014c0b2e72d7f584592c1271ae222
|
|
| MD5 |
602ee7f4cd8a1925953f8f42af3967d7
|
|
| BLAKE2b-256 |
0c708827306da528be2c776d8afe9e0c81d2eebf1e10218cac36c5686f157426
|
File details
Details for the file ssimulacra2-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ssimulacra2-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
537239a599b8a332da4ea40d021a26358ade9648b6f5c8bbfc3bb9c2cb30a6a1
|
|
| MD5 |
c2563ba4b37bf8cb890410dc1173bf34
|
|
| BLAKE2b-256 |
536ba0ba4d518f7d0e618ab2e2b42cbbe56a1fcabcec96ed63750ab7796f1aa3
|