Skip to main content

Buy Me A Coffee

Sewar

Downloads Build Status codecov PyPI version

Sewar is a python package for image quality assessment using different metrics. You can check documentation here.

Implemented metrics

  • Mean Squared Error (MSE)
  • Root Mean Squared Error (RMSE)
  • Peak Signal-to-Noise Ratio (PSNR) [1]
  • Structural Similarity Index (SSIM) [1]
  • Universal Quality Image Index (UQI) [2]
  • Multi-scale Structural Similarity Index (MS-SSIM) [3]
  • Erreur Relative Globale Adimensionnelle de Synthèse (ERGAS) [4]
  • Spatial Correlation Coefficient (SCC) [5]
  • Relative Average Spectral Error (RASE) [6]
  • Spectral Angle Mapper (SAM) [7]
  • Spectral Distortion Index (D_lambda) [8]
  • Spatial Distortion Index (D_S) [8]
  • Quality with No Reference (QNR) [8]
  • Visual Information Fidelity (VIF) [9]
  • Block Sensitive - Peak Signal-to-Noise Ratio (PSNR-B) [10]
  • Hypercomplex Image Quality Index (Q2n) [11]

Todo

  • Add command-line support for No-reference metrics

Installation

Just as simple as

pip install sewar

Running tests

pip install pytest pytest-cov
pytest --cov=sewar

Example usage

A simple example to use UQI. All metric functions expect numpy arrays in H x W x C format (height x width x channels):

>>> import numpy as np
>>> from PIL import Image
>>> from sewar.full_ref import uqi
>>> img1 = np.asarray(Image.open("image1.tif"))
>>> img2 = np.asarray(Image.open("image2.tif"))
>>> uqi(img1, img2)
0.8847521481522062

Example usage for command line interface

sewar [metric] [GT path] [P path] (any extra parameters)

An example to use SSIM

foo@bar:~$ sewar ssim images/ground_truth.tif images/deformed.tif -ws 13
ssim : 0.8947009811410856

Available metrics list

mse, rmse, psnr, rmse_sw, uqi, ssim, ergas, scc, rase, sam, msssim, vifp, psnrb, q2n

Contributors

Special thanks to @sachinpuranik99 and @sunwj.

References

[1] "Image quality assessment: from error visibility to structural similarity." 2004)
[2] "A universal image quality index." (2002)
[3] "Multiscale structural similarity for image quality assessment." (2003)
[4] "Quality of high resolution synthesised images: Is there a simple criterion?." (2000)
[5] "A wavelet transform method to merge Landsat TM and SPOT panchromatic data." (1998)
[6] "Fusion of multispectral and panchromatic images using improved IHS and PCA mergers based on wavelet decomposition." (2004)
[7] "Discrimination among semi-arid landscape endmembers using the spectral angle mapper (SAM) algorithm." (1992)
[8] "Multispectral and panchromatic data fusion assessment without reference." (2008)
[9] "Image information and visual quality." (2006)
[10] "Quality Assessment of Deblocked Images" (2011)
[11] "Hypercomplex quality assessment of multi/hyperspectral images." (2009)

Metadata

Release files for sewar 0.4.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sewar 0.4.9
File Size Uploaded Provenance Actions
sewar-0.4.9.tar.gz 14.9 kB Without provenance Details for sewar-0.4.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sewar 0.4.9
File Interpreter ABI Platform Actions
sewar-0.4.9-py3-none-any.whl Python 3 none any Details for sewar-0.4.9-py3-none-any.whl

Total release size: 28.9 kB

Release files / sewar-0.4.9.tar.gz

Download URL sewar-0.4.9.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f4942a5ca0f7e4b15a3a74a7942e0531a5b2edbe345b016ab76c8013d5453a8d
BLAKE2b-256 checksum
How to use checksums
dcf34305bc1a39e7d442e210679823ba8aa3ac5c582f1315f2ae38f476a12b9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / sewar-0.4.9-py3-none-any.whl

Download URL sewar-0.4.9-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8e0fda9d790300fe40eed80c6c3372e4f1ec160d0df4ba4450c520aada6d930
BLAKE2b-256 checksum
How to use checksums
6b2c88af83f9eaf906fb589745887a030199099a0c07154e90f7b2b99148c6fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for sewar 0.4.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page