Hello, I need the openmv to give me the approximate height of a tennis ball after detecting it. I have trained my data and the recognition works fine, however, I’m having difficulty measuring the height. I have seen from your other forums the formula which is used to measure the height

def rect_size_to_distance®: # r == (x, y, w, h) → r[3] == h

return ((lens_mm * average_head_height_mm * image_height_pixels) / (r[3] * sensor_h_mm)) - offest_mm

however, I’m having difficulty getting the “r” coordinates. This is how I’m recognizing the tennis ball

for obj1 in tf.classify(net1, img, min_scale=1.0, scale_mul=0.1, x_overlap=0.5, y_overlap=0.5):

predictions_list1 = list(zip(labels1, obj1.output()))

Could someone please help with drawing a rectangle around the tennis ball and getting the height? Thank you in advance