k-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster. This results in a partitioning of the data space into Voronoi cells.
returns a vector of point structs that contain the r,g,b values of the palette.
displays the original image with its corresponding palette superimposed.
after running k-means clustering on the data, we set each point's colour to its centroid's colour.
timelapse gif version of rebuildImage()
takes a gif and reduce its colour to its k-determined palette.
- CImg 1.6.x
#include "kimages.h"
int main(){
kimages foo("\pictures\image.bmp", 5);
foo.displayPalette();
return 0;
}
- Change the palettes of other images to fit new ones.
- Video colour change
- Fix for gifs with matte backgrounds or transparency.