NeoGeographyToolkit / StereoPipeline

The NASA Ames Stereo Pipeline is a suite of automated geodesy & stereogrammetry tools designed for processing planetary imagery captured from orbiting and landed robotic explorers on other planets.
Apache License 2.0
479 stars 168 forks source link

Verification of Stereo Parameters #312

Closed rbeyer closed 4 years ago

rbeyer commented 4 years ago

We have only a very brief statement in the docs about selecting pairs.

Is there software out there for evaluating the 'fitness' of a particular pair for stereo, like those detailed in this LPSC abstract (recently added to our docs)?

Are there any online tools that we could direct people to, or perhaps we could rough out a tool for evaluating the metadata for a pair?

dpmayerUSGS commented 4 years ago

PILOT has a "Stereo" tab that can be used to identify stereopair candidates from among image search results. It even has a button to automatically apply recommended parameter ranges from the LPSC abstract you cite. I'll be the first to admit that the tool is a little clunky, but I've definitely used it to get a "first cut" of stereopair candidates from CTX.

Edited to add: The source code for the stereo tool in PILOT is available on GitHub: https://github.com/USGS-Astrogeology/PILOT/blob/a8b9f08584baeaad67bd32f390430681238a6aaf/js/pilotStereo.js

rbeyer commented 4 years ago

Before I posted, I fished around on the PILOT site, but I couldn't find it, thanks @dpmayerUSGS. I didn't realize I needed to have a 'result set' first. Here is an LPSC abstract that covers the instructions for the Stereo finding features of PILOT.

rbeyer commented 4 years ago

So PILOT is good for finding pairs, and other people on the mailing list have pointed out algorithms or SQL queries for searching through a database.

However, I wanted something that was more diagnostic. We get a lot of queries via the mailing list and these Issues, about someone having a problem with a particular pair. Often, the first thing we need to do is just evaluate the basics of the particular stereo pair.

So I whipped up a little stand-alone Python program (that depends on kalasiris and pvl) to do just that: https://github.com/rbeyer/scriptorium/blob/master/paired.py

It works like this:

% paired.py -h

usage: paired.py [-h] [-v] file file

This program attempts to read information from two sets of image metadata and
provide an analysis of what kind of stereo pair they might make. It currently
only works with ISIS cubes that have had spiceinit run on them. However, it
could be adapted to read other kinds of image metadata and perform its
calculations. The math and quality metrics are based on Becker et al. 2015,
Criteria for Automated Identification of Stereo Image Pairs
(https://www.hou.usra.edu/meetings/lpsc2015/pdf/2703.pdf)

positional arguments:
  files          Cube files or caminfo output.

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose  Will report information.

The quality values reported by this program are based on the recommendations
and limitations in Becker et al. (2015). They have a value of one for an ideal
value, between zero and one for a value within the acceptable limits, and less
than zero (the more negative, the worse) if the value is beyond the acceptable
limit.

% paired.py P02_001981_1823_XI_02N356W.cub P03_002258_1817_XI_01N356W.cub

Stereo Pair Quality Report:

Image 1: P02_001981_1823_XI_02N356W.cub
Image 2: P03_002258_1817_XI_01N356W.cub
                        Image 1  Image 2
       Incidence Angle:  54.12    57.10
               Quality:   0.73     0.53
        Emission Angle:   4.79    26.34
               Quality:   0.21     0.83
           Phase Angle:  58.69    31.50
               Quality:   0.98     0.48

 Subspacecraft Azimuth:  81.70   263.38
      Subsolar Azimuth: 274.20   274.20
               Quality:       1.00
Ground Sample Distance:   5.42     6.63
               Quality:       0.85

Stereo Overlap Fraction: 0.58
        Overlap Quality: 1.00

            Parallax Angle: 31.13
Parallax/Height Ratio (dp): 0.58
   Stereo Strength Quality: 1.00

Stereo Tip Distance (dsh): 0.22
     Illumination Quality: 0.92

Honestly, I can't believe it has taken me so long to write this, it could have been so useful, so many times. Also, if you need a Python implementation of the math detailed in the Becker et al. (2015) LPSC abstract, you'll find functions in the program.

Maybe we'll get this put into the next ASP release.