How can I detect the color of a certain portion of an image if I know the coordinates of this portion as a rectangle?
I'm working on contour and color detection, I managed to detect the contours and determine the shapes (rect, tri ...) but I want to identify the color of the rectangle for example how can I do so?
Thanks in advance.
To get the color of an image at a specific position you can use
Vec3b color = image.at<Vec3b>(Point(x,y));
What do you need exactly? How much different colors are in your images?or you can use a Mask to delete everything from the image except what you want it to remain within your rectangle...
gfx