I am using Azure cognitive-service custom vision service to detect shapes from capture images. As per their documentation, I got the response as per their format.
But I
These boundingBox values are in percent of the image original size, so you can draw the rectangle by multiplying the values by the image width (for left and width values) or by the image height (for top and height values).
Keep in mind that the position is expressed from the top left corner, so position 0,0 is this corner.
I got a small custom vision detecting cola bottles.
Original image is the following one:
I used the Custom Vision portal to make a prediction and got the following result - let's focus on this highlighted result with a 87,5% score:
Using the API (available here), I also made the Predict operation and got (among other details) this prediction:
{
"probability": 0.875464261,
"tagId": "1932c95f-ed4a-4675-bde4-c2457e1389e6",
"tagName": "CocaLight",
"boundingBox": {
"left": 0.453497916,
"top": 0.0,
"width": 0.2523211,
"height": 0.8738168
}
}
Considering that my image dimension is 800 x 652 (so ImageWidth 800, ImageHeight 652):
Rectangle draw
Top left point position?
So my rectangle starting position is (362,0).
Size?
Let's draw it!
Looks right!