How to find different colors present in an image? Is K means clustering enough or any other simple way of doing it using opencv exist?

  • 1
    $\begingroup$ What's wrong with reading the image as an array, and then counting the number of unique array elements? K-means doesn't solve this problem and using opencv is like killing a mosquito with a cannon, but maybe I'm missing something? $\endgroup$ – MBaz Jul 11 at 1:18
  • $\begingroup$ how can i map the unique array elements to particular colors like red, green, black etc? $\endgroup$ – susane Jul 11 at 6:16
  • $\begingroup$ Depends on how many types of colors you want to define. If you want to map a number of colors to a smaller set of RGB values (say red, green and blue) k-means is a good approach. $\endgroup$ – T A Jul 11 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.