Butteraugli: An Open Source C++ Library for Measuring Perceptual Differences in Images
Butteraugli is an open-source project developed by Google for measuring the perceptual differences between two images. Its name sounds interesting, but its functionality is very powerful. It not only provides a scalar score to represent the differences between two images but also generates a spatial difference map to help users intuitively understand the differences between images.
How It Works
Butteraugli is designed based on the characteristics of the human visual system. It takes into account the differences in sensitivity to different colors and frequencies, for example, the density of blue cone cells in the human retina is lower, and this characteristic is incorporated into the difference assessment model. Additionally, it models the frequency space suppression of ganglion cells more accurately. Through these complex models, Butteraugli can more accurately simulate human perception of image differences.

Application Scenarios
One of the main applications of Butteraugli is as a quality assessment tool for image and video compression. When compressing images or videos, we often need to make trade-offs between file size and image quality. Butteraugli can help developers determine the performance of compression algorithms at different quality levels. For example, it can be used to adjust the quality settings of a JPEG compressor or to compare the effects of different compression methods at the same level of perceptual difference.
How to Use
Butteraugli provides a C++ interface, allowing users to input two images and obtain a scalar value and a difference map. This scalar value can be compared with two reference values to categorize the degree of difference between images into three levels: “Excellent”, “Acceptable”, and “Unacceptable”. Additionally, Butteraugli comes with a command-line tool that supports PNG and JPG image inputs. Users can compare two images and generate a difference map with simple commands.
Compilation and Installation
The code for Butteraugli is portable and can be compiled and run on various operating systems. It uses Bazel as the build tool, and users can build the command-line tool by running bazel build -c opt //:butteraugli. If users wish to use Butteraugli as a library, they can depend on the //:butteraugli_lib target. Furthermore, it also provides a Makefile that users can use to compile if they have libpng and libjpeg installed.
Advantages and Limitations
Butteraugli excels at handling small-scale quality differences, especially in the range of JPEG compression quality from 90 to 95. However, it is not a perfect tool. It is primarily used for research purposes rather than as a practical tool for selecting compression formats. Additionally, its performance in handling highly distorted images has not been thoroughly validated.
Conclusion
Butteraugli is a powerful tool that can help developers better understand and evaluate the perceptual differences between images. It has broad application prospects in the field of image and video compression. If you are interested in image processing or compression, Butteraugli is definitely worth a try.