DOI-USGS / ale

Abstraction Layer for Ephemerides (ALE)
Other
13 stars 31 forks source link

Quaternion sign flip for LROC NAC #603

Open thareUSGS opened 1 month ago

thareUSGS commented 1 month ago

Oleg noticed an issue with some recent LROC NAC testing at the pole. The file M124343339LE.lev1.8bit.json seems to have a problem where the quaternions (used for orientation) have inconsistent signs. Example (line ~2193):

   [
        0.016525284863560585,
        -0.0734723194332759,
        0.9798210267646943,
        0.18514720831558124
      ],
    [
        0.0024593731395100016,
        0.06930709261721921,
        -0.9799803592542052,
        -0.18662522303458276
      ],

Oleg states, each quaternion alone is fine, as it defines the same rotation matrix with any sign. The problem is that the CSM linescan model interpolates between them, and that results in orientations being junk when the quaternions change sign.

He also prepared an image example which is the result after a temporary fix in ASP. Both of these are after mapprojection with ASP. The raw image does not have this artifact, it comes from the camera.

M124343339LE.lev1.8bit.json

csm_mapproject_issue
thareUSGS commented 1 month ago

I can share the cube also (just let me know). Too big to post.

More discussion with Oleg: ALE seems like the correct place to fix (but then it might need to be done for each driver). Alternatively, this "could" be cleaned up when CSM loads the sensor.

Also, these are close to the lunar north pole, so it could be a pole issue. The conversion from rotation to quaternion has to make a choice about sign, and not sure what makes it pick one sign vs another, when close to some extreme like the pole.

acpaquette commented 1 month ago

@thareUSGS If you can post the cube label, that should be enough to get an ISD out of ALE. Oleg mentioning this is at the polls makes more sense

oleg-alexandrov commented 1 month ago

There is no label, this has to come directly from the .img. That one is here: https://wms.lroc.asu.edu/lroc/view_lroc/LRO-L-LROC-2-EDR-V1.0/M124343339LE

If a sanity check with mapprojection is needed with the logic that USGSCSM now provides, the problematic area in the clip above is in the middle of the image (where it is brightest) and the artifact shows up along the entire image width.