I am building a custom vision application with Microsoft's CustomVision.ai.
I am using this tutorial.
When you tag images in object detection projects, you need to specify the region of each tagged object using normalized coordinates.
I have an XML file containing the annotations about the image, e.g. named sample_1.jpg
:
<annotation>
<filename>sample_1.jpg</filename>
<size>
<width>410</width>
<height>400</height>
<depth>3</depth>
</size>
<object>
<bndbox>
<xmin>159</xmin>
<ymin>15</ymin>
<xmax>396</xmax>
<ymax>302</ymax>
</bndbox>
</object>
</annotation>
I have to convert the bounding box coordinates from xmin,xmax,ymin,ymax to x,y,w,h coordinates normalized according to the provided tutorial.
Can anyone provide me a conversion function?