exeter-creww / SFM_Precision

A workflow to create precision maps in python
GNU General Public License v3.0
3 stars 1 forks source link

Default camera optimisation parameters #70

Open marcusspiegel opened 1 year ago

marcusspiegel commented 1 year ago

The default parameters in the precision module are given as ['fit_f', 'fit_cx', 'fit_cy','fit_b1','fit_b2', 'fit_k1', 'fit_k2','fit_p1', 'fit_p2']. However, in James et al. 2017 "the optimal camera model comprised focal length, principal point and three radial distortion components (denoted as Model A)." I believe this should imply ['fit_f', 'fit_cx', 'fit_cy', 'fit_k1', 'fit_k2','fit_k3']. Is this correct?

Even looking at James et al. 2017 Geomorphology, the optimal model (Model C) seems to imply ['fit_f', 'fit_cx', 'fit_cy', 'fit_k1', 'fit_k2','fit_k3','fit_p1', 'fit_p2']. This is still different from the defaults suggested here.

jamesmrj commented 1 year ago

You are correct that "focal length, principal point and three radial distortion components" would mean ['fit_f', 'fit_cx', 'fit_cy', 'fit_k1', 'fit_k2','fit_k3'].

However, the parameter set we found optimal in our survey(s) is not necessarily the parameter set that would be optimal for any other survey. There is no intention to imply that our optional parameter sets should be generally used as default sets for any surveys. The optimal parameters to use will depend on the specific camera and how it has been calibrated. If you are using self-calibration in the survey, the optimal parameters may also depend on the survey design.

To estimate precision using our 2017 Monte Carlo approach, only the parameters for which values have been estimated in the the survey should be included (note that our original code was not designed for using a pre-calibrated camera without self-calibration). These days, Metashape will provide precision estimates for you, so there's no need to use the Monte Carlo approach unless you are trying to dig deeper into details and non-linearities. All the best, Mike

h-a-graham commented 1 year ago

Thanks so much Mike, This is really helpful.

Marcus, this is super useful to point out. I think, basically, these were defaults for our application and would generally work well with similar projects (with a similar sensor). However, as you say this could really benefit from clarification, along with Mike's comment about the more recent improvements to Metashape.

I'll leave this issue open as a reminder to better explain these two points.

Thanks again, Hugh

marcusspiegel commented 1 year ago

Thanks for the response, Mike! Yes I have seen in your 2020 paper that the Monte Carlo approach is not necessary anymore, and I am using that code to export the precision estimates. I am still choosing which parameter set to use during the bundle adjustment phase of my workflow, where I "Optimize Cameras" at each step of filtering out low quality tie points. I guess you are suggesting I should choose parameters based on the initial parameters within "Camera Calibration"?

And thanks Hugh! It's great to have this activity on this repo.

Best, Marcus

jamesmrj commented 1 year ago

This probably depends on where the initial parameter selection came from (e.g. using Metashape default settings, Metashape's best guess at what parameters to use, or an external camera calibration that you have imported). Overall, if you have an initial calibration, then which camera parameters to estimate within the survey bundle adjustment will depend on (i) how good the initial calibration is at representing the camera in the survey and (ii) how good the survey data are for improving the initial calibration via self-calibration (i.e. how strong the image network geometry is and the quality of the images etc). In most aerial cases with off-the-shelf UAS, despite surveys tending to have weak image network geometry, survey output can be improved by using self-calibration. In this case, optimising the parameters that have been included in the initial calibration might be a reasonable approach.

However, if you set some of the parameters values to zero, exclude them from the adjustment and still get as-good survey output results after a self-calibrating bundle adjustment, then you know that these parameters are not having a useful effect and can be neglected (the approach used in our 2017 Geomorphology paper). This is simply the same ethos as not using a 5-parameter polynomial to model time series data that can be described very adequately by a quadratic model (less is more!).

All the best, Mike

marcusspiegel commented 1 year ago

Thanks Mike! That is very helpful. I'll incorporate this into my approach.

-Marcus