DOI-USGS / usgscsm

This repository stores USGS Community Sensor Model (CSM) camera models
Other
26 stars 33 forks source link

Line Scan groundToImage Fix #436

Closed acpaquette closed 1 year ago

acpaquette commented 1 year ago

When converging on an approximate line, when calculating for the error in the detector distortion was not being applied.

On cameras with fairly minor distortion this results in fairly minimal difference in resulting line. On camers, like kaguyatc, with more prevalent distortion, this caused the line to be off by as much as 2 pixels.

Related to this ALE issue: https://github.com/USGS-Astrogeology/ale/issues/508

acpaquette commented 1 year ago

@oleg-alexandrov Would you mind checking this out? I want to make sure that this seems reasonable with the results I am seeing. I also tested with MROCTX and got just as good if not better line estimates.

It is likely that this will make the estimation process slightly slower but negligibly so(?)

acpaquette commented 1 year ago

Right, it looks like both KaguyaLISM and LroNAC use an iterative solve method so some time cost will be incurred on both of those instruments

oleg-alexandrov commented 1 year ago

I guess one can time things to see if the slowdown is large. If it is, longer term, given that these sensors have rather weak distortion, it is possible to fit to this distortion model another one which operates in the reverse direction. Not something one would view as a high priority.

acpaquette commented 1 year ago

@oleg-alexandrov Doing some experiments in python comparing times in LRONAC, MRO CTX and KaguyaTC. This will add between sub 1 and ~15 seconds to a full image back projection in USGSCSM. Which for something like LRONAC having 51200 lines and 5064 samples is fairly negligible.

In terms of accuracy gain/loss. LRONAC loses no accuracy on the back projected line and MRO CTX loses an average of 0.0002 pixel accuracy on the back projected line.

Overall this change seems reasonable, having minor decreases to performance with negligible accuracy lose in the more tested line scan instruments. All to gain +2 pixel accuarcy in KaguyaTC

oleg-alexandrov commented 1 year ago

This is good to know, thank you. So, this fixes the issue where a prime suspect was the projective vs linear initial guess transform? Did you have to switch back there to the linear initial guess?

This is an important fix. The error due to incorrectly modeled distortion can be worse than 2 pixels, if the line sensor is is not precisely where the optical center is, and many cameras do have more than one sensor line, when for the ones further away from the line having the optical center unmodeled distortion errors would get progressively worse.

acpaquette commented 1 year ago

This allows us to keep the new projective transform but takes into account more aggressive(?) distortion models. MRO CTX and LRONAC seem fairly tame compared to kaguyaTC but I am unfamiliar with what constitutes a more extreme distortion.

With the above information in mind, does this still seem good to merge?

oleg-alexandrov commented 1 year ago

Looks good to me.

As to the initial guess projective transform, one could presumably compute it with pixels which are not image corners, like now, but more centrally located ones, where the distortion is less and this transform could be more accurate. (Note that the original linear approximation transform used corners too.) I don't think we should do it, that is an initial guess anyway, but maybe the distortion explains why that projective transform is not as good for kaguyaTC as it was for other sensors.