I found this calculation from https://photo.stackexchange.com/questio ... in-a-photo
Using the measurements:
Focal length: 45
Real face height: 200mm
Image height : 240px (QVGA)
h (the pixel height of the face from the net_boxes array)
Sensor height: 2.7mm (1/4 inch sensor)
and using code similar to below
Code: Select all
static void draw_face_boxes(dl_matrix3du_t *image_matrix, box_array_t *boxes)
{
int h, i;
for (i = 0; i < boxes->len; i++) {
h = (int)boxes->box[i].box_p[3] - y + 1;
int eq_top = 45 * 200 * 240; //f(mm) x real height(mm) x image height(px)
int eq_bottom = h * 2.7; //object height(px) x sensor height(mm)
int face_distance = eq_top/eq_bottom;
Serial.println(face_distance);
}
Is one of the measurements incorrect or is this an optics issue?