Skip to main content
. 2022 May 18;22(10):3832. doi: 10.3390/s22103832
Algorithm 1:Face size estimation algorithm.

Input: the face image, the key-points detected on the face, and the estimated distance for the ears in pixels.

Output: the estimated face size as the ear-to-ear distance in millimeters.

  • 1:

    functionFaceSizeEstimation(input_img,kpts,ear2ear_pixels)

  • 2:

        eye_kpts fetch_eyes_kpts (kpts)               ▹ left, right eyes

  • 3:

        padding10

  • 4:

        px2mm0

  • 5:

        detection_count0

  • 6:

        for eye_kpts in eyes_kpts do

  • 7:

            eye_img crop_image input_image,eye_kpts,padding)

  • 8:

            eye_img gamma_correction eye_img)

  • 9:

            eye_imgeye_img[:,:,0]          ▹ use red channel only

  • 10:

            mask drn_d_22_process eye_img)            ▹ predicts the iris segmentation mask

  • 11:

            iris detect_hough_circle mask)▹ fits a circle over the segmentation mask

  • 12:

            mm11.71/(2iris.radius)     ▹ size of a pixel in millimeters

  • 13:

            if mm is not ’nan’ then              ▹ estimation successful

  • 14:

               px2mmpx2mm+mm

  • 15:

               detection_countdetection_count+1

  • 16:

        if detection_count>0 then

  • 17:

            px2mmpx2mm/detection_count            ▹ average size of a pixel in millimeters

  • 18:

        else

  • 19:

            raise Exception(’Face size estimation failed!’)

  • 20:

        return ear2ear_pixelspx2mm          ▹ ear to ear distance in millimeters