In Android, I am currently accessing the camera's
focal length by using getFocalLength()
in Camera1
. Camera2
is not an option.
I am trying to full fill the current calculation: focal_length_pix = focal_length_m * 1 (pix) / pixel_width_m
.
Basically this converts the focal length
from mm
-> px
. Now I know the focal_length_m
variable but I am currently trying to figure out the pixel_width_m
which is is the width of a pixel (on the sensor) in meters.
I am struggling to find a way to calculate the width of a pixel on the sensor. Any suggestions, ideas would be much appreciated.
You are able to calculate the focal length
in pixels
by the following:
double focal_length_pix = (size.width * 0.5) / tan(horizontalAngleView * 0.5 * PI/180);
size
derives from getPreviewSize()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With