Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV c++ K-Means Color Clustering

Hi,

I found some interesting article about colour clustering with OpenCV and Python:

https://www.pyimagesearch.com/2014/05/26/opencv-python-k-means-color-clustering/

I am trying to convert that into c++. Until now without success. Did someone do that already?

Currently I have a problem with following lines:

// reshape the image to be a list of pixels image = image.reshape((image.shape[0] * image.shape[1], 3))

// cluster the pixel intensities clt = KMeans(n_clusters = args["clusters"]) clt.fit(image)