Estimating Depth
For tracking the depth, the following function is implemented. Depth is the distance between the user and the camera. There is a way to calculate depth if you know the focal length of the camera and the average distance between the eyes.
estimate_depth(landmarks)
Estimate the Z-coordinate (depth) for a detected face.
This function calculates the depth, which is the distance between the screen and the user, using a method that relies on the distance between the eyes. It uses the focal length and the average distance between the eyes, to estimate the depth based on eye landmarks detected.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
landmarks |
list[list[int]]
|
A list of arrays, each array representing a landmark with x and y position of that landmark. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
The distance between the user and the camera |
Source code in src/depth.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|