face-api.js icon indicating copy to clipboard operation
face-api.js copied to clipboard

The distance between the eyes

Open smety opened this issue 4 years ago • 2 comments

Hello, thank you to the authors for this nice library.

Is it possible to calculate the distance between the eyes (pupils) in centimeters?

We are trying to use this library in healthcare to detect squinting.

Thank you very much

smety avatar May 04 '20 18:05 smety

this would be quite complex with a regular webcam. The web browser will have great difficulty figuring out the camera properties like focal length, sensor size, etc, as well as accurately estimating how far the user's face is from the camera. It has no information to detect the difference between a small head and a far away head accurately.

To achieve something like this, I think you would need to have the user wear something that provides a reference scale, like a set of eyeglasses that have tracking dots a known distance apart. Then you could measure the distance between the trackers, and scale the distance between the eye pupils to a relative amount within that scale.

If you will only be running the software in a situation where the user's face is a known distance from the camera, using a known camera (i.e. a workstation PC with special equipment, or a standard issue smartphone) you might be able to achieve something decent without a reference scale, but I think it will be difficult to do well.

If it was easy to measure IPD in real measurements using a regular webcam, the online eyeglasses companies that have AR eyeglasses try on features would surely be doing it.

Bluebie avatar Jun 01 '20 04:06 Bluebie

@Bluebie ok, thank you :)

smety avatar Jun 10 '20 15:06 smety