Optimized $k$-means color quantization of digital images in machine-based and human perception-based colorspaces
Abstract. Color quantization represents an image using a fraction of its original number of colors while only minimally losing its visual quality. The k-means algorithm is commonly used in this context but has mostly been applied in the machine-based RGB colorspace composed of the three primary colors. However, some recent studies have indicated its improved performance in human perception-based colorspaces. We investigated the performance of k-means color quantization at four quantization levels in the RGB, CIE-XYZ, and CIE-LUV/CIE-HCL colorspaces on 148 varied digital images spanning a wide range of scenes, subjects, and settings. The visual information fidelity measure numerically assessed the quality of the quantized images and showed that in about half of the cases, k-means color quantization is best in the RGB space, whereas at other times, and especially for higher quantization levels (k), the CIE-XYZ colorspace is where it usually does better. There are also some cases, especially at lower k, where the best performance is obtained in the CIE-LUV colorspace. Further analysis of the performances in terms of the distributions of the hue, chromaticity, and luminance in an image presents a nuanced perspective and characterization of the images for when each colorspace is better for k-means color quantization.