merry-go-round
merry-go-round

Reputation: 4615

How to assign a single color to a pixel region?

Let's say we have one guy wearing a blue shirt. I built haarcascade classifier which detect the shirt object. Once it detect the blue shirt object, how can I get the hexadecimal color value of the blue shirt?

input: image -> output: #0000FF (output can be multiple colors if it's possible)

I want to get this result using OpenCV with python or C++. Any useful link or paper? (I've googled it more than an hours but can't find what I want)

Thanks.!!

Upvotes: 1

Views: 140

Answers (1)

Sneaky Polar Bear
Sneaky Polar Bear

Reputation: 1671

Converting hex color to RGB and vice-versa

If you already have the shirt segmented, you can take the mean/median rgb prior to hex conversion. If you are using this for recognition, I would also set up the primary axes of your color ellipsoid for specificity. ie establish range and distribution on each of rgb channels. you could do center point and sphere (simple color distance) if you are lazy/ it is a simple enough problem

Upvotes: 1

Related Questions