in code_examples/python_examples/image/python-image-orientation-bounding-box.py [0:0]
def ShowBoundingBoxPositions(imageHeight, imageWidth, box, rotation):
left = 0
top = 0
if rotation == 'ROTATE_0':
left = imageWidth * box['Left']
top = imageHeight * box['Top']
if rotation == 'ROTATE_90':
left = imageHeight * (1 - (box['Top'] + box['Height']))
top = imageWidth * box['Left']
if rotation == 'ROTATE_180':
left = imageWidth - (imageWidth * (box['Left'] + box['Width']))
top = imageHeight * (1 - (box['Top'] + box['Height']))
if rotation == 'ROTATE_270':
left = imageHeight * box['Top']
top = imageWidth * (1- box['Left'] - box['Width'] )
print('Left: ' + '{0:.0f}'.format(left))
print('Top: ' + '{0:.0f}'.format(top))
print('Face Width: ' + "{0:.0f}".format(imageWidth * box['Width']))
print('Face Height: ' + "{0:.0f}".format(imageHeight * box['Height']))