1 | initial version |
I assume you have a region that is the target object? Convert the image to HSV, then take a 3 channel histogram. Depending on what exactly you mean by color, take the most common H, HS, or HSV value and use that. That is, the bin of the histogram with the highest value.
HSV is described here, so you can figure out which of these you actually need.