Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to determine the average BGR values of all the pixels in a closed contour?

I'm a complete newbie to OpenCV, and trying to distinguish between some brightly-colored targets, and false positives. In both cases, I'm looking at a shape which is recognized as a closed contour, but since the disparity between the color and surrounding area is FAR more dramatic on the target than the false positives, I'm planning on using that to cull the false positives ( I know that this is probably far from the most effective way to do this, but it's simple enough for my beginner skills to grasp most of the idea )

My biggest issue is I'm not sure how I can parse this all the pixels inclosed within the contour so I can determine the average color value, and see if it's a target or not. Does anyone have any extremely newbie-friendly ideas as to how this could be accomplished? Thanks a ton