Calculate the Correct Translation and Scaling Transformations for Segmentation Polygons

Viewed 19

I have an image with a list of segmentation polygons. Getting the bounding box with the polygons is easy enough. I used the bounding box to crop out the objects of interest.

Now, I want to scale the polygons so that they wrap around the cropped object. I scaled the polygons using the ratio of the original image size to the crop size. However, I do not know how to add the correct offsets to the bounding boxes. As a result, the polygon points incorrectly wrap around the object.

Example of a correct crop with incorrect segmentation polygons

For object crops, what is the correct transformation for scaling and translating arbitrary points within the crops?

0 Answers
Related