'Getting location of the detected object in world coordinates

Using python Segmentation-Models package, I have trained a model and now I can localize the object on the image. I would like to get the reference point into world coordinate system. Segmented Image

As it is seen one part of the object is kind of straight line. How can I get the middle point of this line and map it into world coordinates. I could maybe use Gabor filter or something like that but the object could be rotated, so the line is has not always same slope. Another Example

I am just looking for a tip to start off. Any idea to reference this object somehow and to map into World coordinate system ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source