A Box question returns top, left, bottom and right edges as fractions of image dimensions. Multiply horizontal coordinates by the displayed width and vertical coordinates by the displayed height. Check confidence before drawing a box.
bounds = answer['box']
x = bounds['left'] * width
y = bounds['top'] * height
w = (bounds['right'] - bounds['left']) * width
h = (bounds['bottom'] - bounds['top']) * heightDisplay the overlay
Apply the normalized coordinates to the displayed image content, excluding letterboxing. In Playground, expand the Box row to see the whole image with its box; the collapsed view shows the crop.
(0, 0)
(1, 1)
Target region
left = 0.25
right = 0.75
top = 0.25
bottom = 0.75