This blog is a companion to the Filter Magic app I wrote. The app runs on Mac OS and lets you explore and play with every single Core Image filter that exists (a.k.a. CIFIlter). The app provides a lot of useful hints and examples, but I felt you might benefit from some additional information which […]
CIKMeans Filter
CIKMeans filter “creates a palette of the most common colors found in the image”. It does so by applying K-means clustering algorithm to partition all colors contained within the image (clipped by the rectangle you specified) into K clusters and produces K colors on its output where each color is the mean color (centroid) of the corresponding cluster.
In practice the filter is hardly used on its own. The most common use case is to use its output as an input to other filters, such as CIPaletteCentroid and CIPalettize filters.
CIKMeans Filter Sample Code Walk Through
CIKMeans filter “creates a palette of the most common colors found in the image”. It does so by applying K-means clustering algorithm to partition all colors contained within the image (clipped by the rectangle you specified) into K clusters and produces K colors on its output where each color is the mean color (centroid) of the corresponding cluster.
In practice the filter is hardly used on its own. The most common use case is to use its output as an input to other filters, such as CIPaletteCentroid and CIPalettize filters.