We need to project a point with 3D coordinates (X, Y, Z) onto an image captured by a mobile phone camera. The formulas for obtaining the corresponding coordinates (x, y) in pixels of the 3D point are:
x = f*X/Z
y = f*Y/Z
(the origin of the coordinate reference system (x, y) is placed for simplicity at the principal point, corresponding in first approximation with the center of the image).
The focal length f is expressed in pixels and the requirement is precisely to be able to determine the focal length of the mobile phone camera in pixels.
Through a library, we are able to derive the horizontal field of view (fov) h_fov and the vertical fov v_fov of the camera sensor ( CameraDevice - NatDevice (videokit.ai) ); we then know the resolution i_widthxi_height in pixels of the acquired image (e.g. 1920x1080).
As explained here
VideoCAD (cctvcad.com)
the active area (see Image sensor format - Wikipedia) corresponding to the image will not be able to utilize the entire sensor if it does not have the same form factor. Assuming as in this image Active area vs sensor size - 1 taken from the VideoCAD (cctvcad.com) link
that the long side of the active area of the image corresponds to the long side of the sensor, the fov that can be used to find the focal length f in pixels is h_fov:
f = (i_width/2)/tan(h_fov/2)
With different aspect ratios as e.g. in the image (again from the VideoCAD (cctvcad.com) link)
Active area vs sensor size - 2
in which it is the short side of the active area that corresponds with that of the sensor, the formula to be used becomes
f = (i_height /2)/tan(v_fov/2)
If the condition is maintained that (at least) one of the sides of the active area coincides with one side of the sensor, even if the image is rescaled the previous formulas continue to apply: if, for example, to generate a 1280x720 image the device acquires a 1920x1080 image and then rescales it from Full HD to HD, the formulas remain valid. If, on the other hand, the device does not use the full extent of the sensor allowed by the aspect ratio to generate the image, but only part of it so that the edges of the active area do NOT reach the edge of the sensor, it is not possible to directly use the h_fov or the v_fov in the previous formulas, but the fov to be used must be recalculated to take into account what the shared link calls the "crop factor" (see in particular par. "Specifying the Crop factor").
My question is: is it possible to retrieve the information (fov, "crop factor", image resolution, ...) from a mobile phone to reconstruct the focal length in pixels corresponding to an image generated by the cell with a given resolution? We have fov and image resolution already, what about the "crop factor" i.e. the actual active area?
Thank you in advance for your support!