Quality Metrics In Image Compression

Suman Kunwar
6 min readDec 26, 2021

--

Compression is one of the enabling technologies behind the multimedia revolution we are experiencing. Our ability to rent movies on demand would not be possible without successful algorithms and standards. We can watch them on DVD, stream them on the Internet, use FaceTime, and share images and videos. And we can use so many other cool applications that involve images and videos.

In recent years, digital image compression has been a research topic, and multiple standards have been developed for different applications. In compression, data is minimalized to represent an image/video, while maintaining an acceptable level of quality or recreating the exact same data. JPEG is a very successful standard, introduced over 20 years ago in 1991. It has become widely used. For example, it can be found in almost every digital camera. Cameras by default save captured images as JPEG. Some high-end cameras also offer raw data.

Due to distortions during the acquisition and processing of images, image quality can deteriorate. Noise, blurring, ringing, and compression artifacts are examples of distortion. Efforts have been made to develop objective measures of quality. Many applications rely upon subjective perceptions of quality as valuable quality metrics. Furthermore, it is possible to track unperceived errors as they propagate through an image processing pipeline, as well as to compare image processing algorithms using quality metrics. A distortion-free image can be used as a reference to compare the quality of other images. It is possible to evaluate the quality of compressed images by evaluating an uncompressed version of the image.

The full reference quality metrics allow you to compare the target image and the reference image directly. In the absence of a distortion-free reference image. A no-reference quality metric can be used. It computes quality scores based on expected image statistics. In full-reference algorithms, the input image is compared with a reference image that has no distortion.

Full Reference Quality Metrics

Mean-squared error (MSE): It is one of the most common image error metrics used to compare image compression quality. It represents the cumulative squared error between the compressed and the original image. The lower the MSE, the lower the error. The MSE can be calculated by using the following formula.

Peak signal-to-noise ratio (PSNR): PSNR stands for peak signal-to-noise ratio. PSNR is derived from the mean square error and indicates the ratio of the maximum pixel intensity to the power of the distortion. This ratio is often used as a quality measure between the original and a compressed image. In the quality degradation of image and video compression, the PSNR value varies between 30 and 50 dB for the representation of 8-bit data and between 60 and 80 dB for 16-bit data. For wireless transmission, the accepted range of quality loss is about 20–25 dB. The higher the PSNR value, the better the quality of the compressed or reconstructed image. The PSNR can be calculated by the following formula.

Structural similarity (SSIM) index: It is a perception-based model that measures the structural similarity between images. A single SSIM score is derived by combining image structure, luminance, and contrast. Luminance and contrast are normalized to account for patterns of pixel intensity among neighboring pixels.SSIM’s quality metric is more closely aligned with the subjective quality score since the human visual system is good at detecting structure. Here, image degradation is considered as a change in the perception of structural information. The SSIM can be calculated by using the following formula.

Multi-scale structural similarity (MS-SSIM) index: Unlike the SSIM index, MS-SSIM takes into account both luminance information at the highest resolution level, as well as structure and contrast information downsampled to several resolutions. There are multiple scales to take into account the perception of detail in an image. These scales include the viewing distance from the image, the distance from the scene to the sensor, and the resolution of the image acquisition sensor. The MS-SSIM can be calculated by using the following expression.

No-Reference Quality Metrics

No-reference algorithms evaluate the image quality by using statistical features from the input image.

Blind/Referenceless Image Spatial Quality Evaluator (BRISQUE): Based on a database of images with known distortions, a BRISQUE model is trained to evaluate the quality of images with the same type of distortion. BRISQUE is opinion-aware, meaning the training images come with subjective quality scores.

Natural Image Quality Evaluator (NIQE): NIQE can measure image quality with arbitrary distortion, even when it is trained on a database of pristine images. The NIQE does not rely on subjective quality scores and is opinion-unware. There is the tradeoff that the NIQE score of an image might not correlate with human perception of quality as much as the BRISQUE score.

Perception-based Image Quality Evaluator (PIQE): A trained model is not necessary for the PIQE algorithm, since it is opinion-unware and unsupervised. In most cases, PIQE performs similarly to NIQE for measuring the quality of images with arbitrary distortion. The quality score is computed by estimating block-wise distortion and measuring the local variance of perceptibly distorted blocks.

With the BRISQUE and NIQE algorithms, a model is trained and the quality score is computed with optimal efficiency. A PIQE may not be as computationally efficient, but it provides both local and global quality measures.

JPEG compression is a lossy compression that comes with a trade-off between file size and decomposed image quality. The image content also affects the tradeoff. Images with uniform areas, for instance, can be compressed to smaller file sizes and exhibit fewer artifacts than images with detailed features. Using image quality metrics, we can analyze this tradeoff while minimizing the impact of image content. Let’s take the example of the llama image and compress it with different ratios.

The nature of artifacts can be viewed by zooming in. We can see artifacts in JPEG quality 10.

The metrics score increases, as does the JPEG quality. For each score in the uncompressed image, normalize it so that the value is the same. For each of these three metrics, a lower score indicates better image quality. For uncompressed JPEG images, BRISQUE scores of 50, 60, and 70 are unrealistically low. As a result, NIQE and PIQE are more reliable metrics for images like the test image.

Conclusion

In JPEG compression, there’s a tradeoff between the size and quality of decomposed images. The acquisition and processing of images can lead to the deterioration of an image, degrading image quality. Metrics can be used as a baseline to measure the quality of the compression and can be categorized into reference and non-reference quality metrics based on the method of comparison. In terms of agreement with a subjective human quality score, all no-reference quality metrics usually outperform full-reference metrics.

References

--

--

Suman Kunwar

Innovating Sustainability | Researcher | Author of Learn JavaScript : Beginners Edition