![]() Line 25 – We are zipping percentages and colors together like.of pixels, 1000 in the above case, so the percentage array becomes of pixels belonging to class 0 or cluster 0(our indexing starts from 0), and so on, and then we are simply dividing that array by the total no. np.unique(kmeans.labels_,return_counts=True), this statement will return an array with 2 parts, first part will be the predictions like, means to which cluster that pixel belongs and the second part will contain the counts like where 100 depicts the no. Line 24 – We are calculating the dominance of each dominant color.Now we know that these 5 colors are the dominant colors of the image but still, we don’t know the extent of each color’s dominance. Line 22 – We are extracting these cluster centers.These groups will have some centroids which we can think of as the major color of the cluster (In Layman’s terms we can think of it as the boss of the cluster). These pixel colors will now be clustered into 5 groups. In this step, the flattened image is working as an array containing all the pixel colors of the image. ![]()
0 Comments
Leave a Reply. |