Question

I am using GPC (General Polygon Clipper) to create sets of images. I am unable to determine if the images are from disjoint sets though.

I am using a gpc_polygon struct defined at the above link, reading the vertex list from an image data (lat/lon of corners)... And adding images sequentially to a polygon.

It is important to separate images that belong to separate regions. While I can't say for sure that the intersection area will be non-zero (that would have been a perfect test), I have noticed that the num_contours of the completed polygon coincides with the number of distinct regions.

I thought that I can use num_contours to determine if an image belongs to a set.

Yet, as I add images, I can see, on one image, num_contours=1, after the second, it increases to 2 (whether the image is in the same section or not, and that makes sense)... but it doesn't increase after that, until the pattern of disjointed images is really off - so I can't really use it to test, at least not on its own.

It is the same as I remove images from the polygon, using a DIFF operator.

If anyone else has used GPC, or some other method of polygon convolution, perhaps you can give me some advice on what I can use to identify which images belong to each contour, so I can either separate them before, or after, polygon creation ?

Was it helpful?

Solution

I used num_contours, with a limiting value of 2 instead of 1, and had to go back iteratively, and try to re-add contours, until I couldn't add them anymore. The solution is suboptimal, may be very slow, and there are situations when polygons that don't belong together end up in the same contour.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top