[software] Add a --focal_multiplier option for camera not registered in the sensor_camera_db
Following numerous requests (#1977,#669, #666 ..), we will introduce a way to handle images with unknown sensor_db correspondence. Notes:
-
We will display a warning:
- if the camera is not detected in the DB
- if the focal_multiplier option is used (since we believe we need to remind our user, that knowing your input camera and image system is the best way to obtain good results in photogrammetry)
- A value of -1 will be able to be specified to still keep the behavior that some cameras intrinsics could be unknown, and that the focal length and camera parameter should be retrieved by camera resection and bundle adjustment. => Reproducibility of the actual behavior of the library
A bit of geometry:
The default parameter will most likely be focal_multiplier == 1.2 since it would correspond to a FoV (Field Of View) of 45 degrees.
For example if we simulate a 45 degrees of viewing angle the focal_multiplier will be => 0.5/tan(0.5 * FoV) => 0.5/tan(0.5 * 45/180*3.14) => 1.2
Then we can approximate the focal length as focal_multiplier * max(w,h)
So the formula focal_multiplier * max(w,h) will provide a putative good guess for our community 3D reconstruction.
I suggest it could be beneficial to use FocalLengthIn35mmFormat or FocalPlane[X-Y]Resolution exif tag if present too. this mechanism is already in use in @MicMacIGN for quite a long time and we already have all set up in the exif handling library https://github.com/openMVG/openMVG/blob/3819c8644d1fea0dfe4eaae27d7e4fcaad318649/src/openMVG/exif/exif_IO_EasyExif.cpp#L102-L115
Do you think it could be a valuable solution ?
Thank you @rjanvier for suggesting that back. Obviously we could add this. We just need some time to do so.
@rjanvier made a commit with an option focal_multiplier
Regarding getFocalLengthIn35mm I was surprised that no value was returned for my Canon EOS 70D. So our EXIF parser is perhaps not optimal.
I also found that a Scale Factor To 35 mm Equivalent: 1.6 is reported by exiftool
Else do you know how to compute the focal length in pix from FocalLengthIn35mmFormat and/or FocalPlaneX/YResolution
I recommend checking how Metashape does so here.
"pixel size (mm)" value in Metashape is based on the following EXIF tags: FocalPlaneXResolution, FocalPlaneYResolution and FocalPlaneResolutionUnit
In case they are missing or incomplete, the value is estimated basing on FocalLength and FocalLengthIn35mmFilm tags in the following way: pixel_size = FocalLength / FocalLengthIn35mmFilm * Diag35_mm / Diag_pix, where Diag35_mm = sqrt(36^2 + 24^2) and Diag_pix = sqrt(width_pix^2 + height_pix^2)"