March 2019
Intermediate to advanced
532 pages
13h 2m
English
In this subsection, we will apply the k-means clustering algorithm to the problem of color quantization, which can be defined as the process of reducing the number of colors in an image. Color quantization is a critical point for displaying images on certain devices that can only display a limited number of colors (commonly due to memory restrictions). Therefore, a trade-off between the similarity and the reduction in the number of colors is usually necessary. This trade-off is established by setting the K parameter properly, as we will see in the next examples.
In the k_means_color_quantization.py script, we perform the k-means clustering algorithm to perform color quantization. In this case, ...