Bounding Box of a Face

The Face Bounding box or Face Rectangle is a 4 coordinate value which defines a tight crop rectangular box which encloses a face.

Use Case for a Face Bounding Box

When uploading a photo which contains more than one face to any of the FaceAPIs (apart from Face Detect), it is necessary to provide a bounding box so that the API will know which face is to be analysed.

Read more on how to use the bounding box in the API in the following articles:

The four Coordinates

The 4 coordinates provided in the face rectangle/ Face bounding box are X, Y, X+W, Y+H where

  • X isĀ  x-axis coordinate
  • Y is y-axis coordinate
  • W is the width of the bounding box
  • H is the height of the bounding box

All measurements are in pixels. The FaceDetect API provides the bounding box in its output (under attribute name face_rectangle) along with the size of the image in pixels. Using these two results (face_rectangle & image size) the bounding box can be drawn.

Getting the Bounding box/ Face Rectangle

The Face Bounding Box / Face Rectangle is one of the results obtained from the Face Detect API

Please refer to the Sample Response of the Face Detect API to see the results obtained from processing the image shown above (You can see the complete response here). The attribute “face_rectangle” is the bounding box required for API along with the “image_size” to accurately plot the bounding box

Related Articles
Post a Comment