Determining Lost Image Quality Through Lossy Compression

379 views Asked by At

I recently came upon a question that I haven't seen anywhere else while searching about lossy compression. Can you determine the quality lost through a certain algorithm? I have been asking around and it seems like that there isn't a sure way to determine the quality lost compared to an original image and can only be differentiated by the naked eye. Is there an algorithm that shows % lost or blended?

I would really appreciate it if someone could give me some insight into this matter.

1

There are 1 answers

1
Benjamin On

You can use lots of metrics to measure quality loss. But, of course, each metric will interpret quality loss differently.

One direction, following the suggestion already commented, would be to use something like the Euclidian distance or the mean squared error between the original and the compressed image (considered as vectors). There are many more metrics of this "absolute" kind.

The above will indicate a certain quality loss but the result may not correlate with human perception of quality. To give more weight to perception you can inspect the structural similarity of the images and use the structural similarity index measure (SSIM) or one of its variants. Another algorithm in this area is butteraugli.

In Python, for instance, there is an implementation of SSIM in the scikit-image package, see this example.

The mentioned metrics have in common that they do not return a percentage. If this is crucial to you, another conversion step will be necessary.