1 | initial version |
I would suggest to try histograms. You can call calcHist and then calcBackProject. As a result you will have a Mat with pixel values which show the histogram bin index = color ID. Having such Mat it should be easy to understand how many blobs of every color ID do you have, i.e. by contour analysis.