Ask Your Question

Revision history [back]

Use a mask. Get the user selection as a contour then draw it as filled in a separate blank image. The 2nd image from the left below is the mask. Many OpenCV functions can use a mask. If you just need to access the pixels, you can iterate through each pixel in the contour's bounding rect roi but only use the ones that are "on" (non-zero) in the mask.

image description