as mentioned here (sec:Depth-from-Iris: Depth Estimation from a Single Image) the iris model could be used to get distance from screen using triangle similarity. I'm trying to implement this on a browser webapp using mediapipe iris but not sure how to get the camera focal length. Which camera capture API can I use to get the focal length of user's camera ?
Asked
Active
Viewed 589 times
1 Answers
0
Unfortunately there is no API available that can give you this information. When I tried to answer the same problem I looked at this:
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices
Which gives you a list of device information. From that you might be able to guess i.e. if the device.label is FaceTime HD Camera (Built-in) you can guess the focal length to be 50 mm.
But this isn't usually the best option so what I'd do is just have a field that lets the user specify focal length and sensor size. Then you can calculate focal length in px for that particular example.

Elijah Ahmad
- 36
- 3