Jeanvit / KMeansDemo

A simple program to show how OpenCV's KMeans works displaying its visual output in "real time"
http://jeanvitor.com/k-means-image-segmentation-opencv/
2 stars 1 forks source link

what is the code inside the for loop doing #1

Closed zam101 closed 2 years ago

zam101 commented 2 years ago

hello, i have read your blog about k-means and i know that the steps of the algorithme are this : kmeans_steps but i can't figure out what this for loop does in your code :

for (unsigned int i = 0 ; i < singleLineSize ; i++ ){
                        data.at<float>(i, 0) = colors(labels[i], 0);
                        data.at<float>(i, 1) = colors(labels[i], 1);
                        data.at<float>(i, 2) = colors(labels[i], 2);
    }

can you explain it to me please ?

zam101 commented 2 years ago

never mind i figured it out , i was just tired .thank you