I will assume the polygon is a contour. (if not, then create a contour from the vertices)
To get the region defined by the contour, I will do the following:
1. Get the BoundingRectangle of the Contour.
2. Use Image.Copy(Rectangle) functoin to get a copy of the BoundingRectangle region.
In step 3-4, we will attemp to set the pixels which do not belong to the contour to black.
3. Create an Image mask of the same size of BoundingRectangle region, use the Image.Draw(Seq ...) function to fill the contour area as 255. Perform an Image Invert function to the mask. The resulting mask should have value of 0 in the contour region and value of 255 outside of the contour.
4. Call the Image.SetValue(0.0, mask) function, such that all region not in the countour is set to black.
Now you get an image of the contour region.
canming
Site Admin
Posts: 877
Joined: Thu Feb 28, 2008 4:16 pm