1 | initial version |
From this question posted by you, I can tell that you already know how to convert an image to HSV, right?
You can read this answer on how to split the channels of an image.
And to count pixels you should probably use calcHist.
I am not sure if you really don't know these sources, after all you are not new to this answer site.