D Why
D Why

Reputation: 37

How to extract color using openCV

Hellow there~ I'm working to make app. This app need feature that detect Rubik's cube color(Realtime). I'm using OpenCV to implement the feature. I try to set up ROI and I detect color in ROI. I know how to detect specific color. I used inRange function on hsv channel image. It's good working. But now I don't know how to check color on specific region. Forexample, rubik's cube color array (00)Red/(01)Blue/(02)Blue (10)Green/(11)White/(12)Orange (20)Yellow/(21)Blue/(22)White. I want to know (0,0)'s color. It's red. I use inRange function like this inRange((0,0)_image, lower_color, upper_color, color_mask). Now how to check (0,0)_image's color what is? How to know that is red? Thank you for your attention. Please let me know.

Upvotes: 1

Views: 774

Answers (1)

lenik
lenik

Reputation: 23556

You should convert your image into HSV color space, where H stands for hue -- that's the color. Hue 0 is red, 0.3 is about green, 0.7 is like blue, you'll figure it out quite easily.

color bar

Upvotes: 0

Related Questions