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
478 stars 168 forks source link

RANSAC error during stereo_parallel of CTX pair #395

Closed Pippo-90 closed 1 year ago

Pippo-90 commented 1 year ago

After the initial preprocessing including mroctx, spiceinit, ctxcal, cam2map4stereo, during the stereo_parallel processing with stereo.default, of a pair of CTX images (F02_036536_1906_XN_10N202W.IMG and G23_027332_1907_XN_10N202W.IMG), I get the following RANSAC issue:


Using tiles (before collar addition) of 2048 x 2048 pixels. Using a collar (padding) for each tile of 0 pixels.

[ 2023-Apr-05 17:56:31 ] : Stage 0 --> PREPROCESSING --> Setting number of processing threads to: 8 Using stereo file ./stereo.default. Writing log info to: ./results/output-log-stereo_pprc-04-05-1756-1184.txt Using session: isis Loading camera model: F02_036536_1906_XN_10N202W.map.cub Loading camera model: G23_027332_1907_XN_10N202W.map.cub Using image files: F02_036536_1906_XN_10N202W.map.cub, G23_027332_1907_XN_10N202W.map.cub --> Computing statistics for left left: [ lo:0.0468547 hi:0.159894 m: 0.117243 s: 0.0147962] --> Computing statistics for right right: [ lo:0.063309 hi:0.16242 m: 0.128251 s: 0.0134226] --> Normalizing globally to: [0.0468547 0.16242] --> Matching interest points in StereoSession. Using epipolar threshold = 1462.54 IP uniqueness threshold = 0.8 Datum: Geodetic Datum --> Name: D_Mars Spheroid: Mars Semi-major axis: 3396190 Semi-minor axis: 3396190 Meridian: Reference Meridian at 0 Proj4 Str: +a=3396190 +b=3396190 Using rough homography. Performing IP matching with alignment. Rough homography--> [****] Complete! Projected 19508 rays for rough homography. Number of inliers: 19508. Aligning right to left for IP capture using rough homography: Matrix3x3((0.999942,3.61223e-06,0)(1.36687e-06,1,0)(2.1711e-10,6.28005e-11,1)) Looking for IP in left image... Using 50 interest points per tile (1024^2 px). Detecting IP Removing IP near nodata with radius 4 Building descriptors Found interest points: 3755 Recording interest points to file: ./results/output-F02_036536_1906_XN_10N202W.map.vwip Looking for IP in right image... Using 50 interest points per tile (1024^2 px). Detecting IP Removing IP near nodata with radius 4 Building descriptors Found interest points: 3749 --> Matching interest points using the epipolar line. Uniqueness threshold: 0.8 Epipolar threshold: 1462.54 Matching forward ---> Obtained 3755 matches. Matching backward ---> Obtained 3749 matches. Matched 1047 points. Unable to find inlier cluster, keeping best 70% of points. Removed 0 points in stddev filtering. Reduced matches to 17

Attempting RANSAC with 3 inliers. RANSAC Error. Number of requested inliers is less than min number of elements needed for fit. (3/8)

Attempting RANSAC with 2 inliers. RANSAC Error. Number of requested inliers is less than min number of elements needed for fit. (2/8)

VW Error: RANSAC was unable to find a fit that matched the supplied data. Traceback (most recent call last): File "/home/brontosaurus/anaconda3/envs/asp/bin/parallel_stereo", line 1086, in normal_run('stereo_pprc', args, msg='%d: Preprocessing' % step) File "/home/brontosaurus/anaconda3/envs/asp/bin/parallel_stereo", line 678, in normal_run raise Exception('Stereo step ' + kw['msg'] + ' failed') Exception: Stereo step 0: Preprocessing failed


I am working on Linux using ISIS 7.2 Ames Stereo Pipeline 3.2.0

Someone who knows how to solve the issue and the reasons?

oleg-alexandrov commented 1 year ago

This is a symptom of your images being so different that the algorithm is having a hard time finding similar match points. You can try to overlay them in stereo_gui and look for illumination changes or not having enough overlap.

One can always delete the work directory and restart stereo with a large --ip-per-image, such as 100000 or so (one can compare what it will print then versus now). When the images are way too different that may not help either but will at least try harder.

On Wed, Apr 5, 2023 at 9:18 AM Pippo-90 @.***> wrote:

After the initial preprocessing including mroctx, spiceinit, ctxcal, cam2map4stereo, during the stereo_parallel processing with stereo.default, of a pair of CTX images (F02_036536_1906_XN_10N202W.IMG and G23_027332_1907_XN_10N202W.IMG), I get the following RANSAC issue:

Using tiles (before collar addition) of 2048 x 2048 pixels. Using a collar (padding) for each tile of 0 pixels.

[ 2023-Apr-05 17:56:31 ] : Stage 0 --> PREPROCESSING --> Setting number of processing threads to: 8 Using stereo file ./stereo.default. Writing log info to: ./results/output-log-stereo_pprc-04-05-1756-1184.txt Using session: isis Loading camera model: F02_036536_1906_XN_10N202W.map.cub Loading camera model: G23_027332_1907_XN_10N202W.map.cub Using image files: F02_036536_1906_XN_10N202W.map.cub, G23_027332_1907_XN_10N202W.map.cub --> Computing statistics for left left: [ lo:0.0468547 hi:0.159894 m: 0.117243 s: 0.0147962] --> Computing statistics for right right: [ lo:0.063309 hi:0.16242 m: 0.128251 s: 0.0134226] --> Normalizing globally to: [0.0468547 0.16242] --> Matching interest points in StereoSession. Using epipolar threshold = 1462.54 IP uniqueness threshold = 0.8 Datum: Geodetic Datum --> Name: D_Mars Spheroid: Mars Semi-major axis: 3396190 Semi-minor axis: 3396190 Meridian: Reference Meridian at 0 Proj4 Str: +a=3396190 +b=3396190 Using rough homography. Performing IP matching with alignment. Rough homography--> [****] Complete! Projected 19508 rays for rough homography. Number of inliers: 19508. Aligning right to left for IP capture using rough homography: Matrix3x3((0.999942,3.61223e-06,0)(1.36687e-06,1,0)(2.1711e-10,6.28005e-11,1)) Looking for IP in left image... Using 50 interest points per tile (1024^2 px). Detecting IP Removing IP near nodata with radius 4 Building descriptors Found interest points: 3755 Recording interest points to file: ./results/output-F02_036536_1906_XN_10N202W.map.vwip Looking for IP in right image... Using 50 interest points per tile (1024^2 px). Detecting IP Removing IP near nodata with radius 4 Building descriptors Found interest points: 3749 --> Matching interest points using the epipolar line. Uniqueness threshold: 0.8 Epipolar threshold: 1462.54 Matching forward ---> Obtained 3755 matches. Matching backward ---> Obtained 3749 matches. Matched 1047 points. Unable to find inlier cluster, keeping best 70% of points. Removed 0 points in stddev filtering. Reduced matches to 17

  • Writing match file: ./results/output-F02_036536_1906_XN_10N202W.map__G23_027332_1907_XN_10N202W.map.match Computing the epipolar rectification using RANSAC with 1000 iterations and inlier threshold 10. RANSAC was unable to find a fit that matched the supplied data. Attempting RANSAC with 5 inliers. RANSAC Error. Number of requested inliers is less than min number of elements needed for fit. (5/8)

Attempting RANSAC with 3 inliers. RANSAC Error. Number of requested inliers is less than min number of elements needed for fit. (3/8)

Attempting RANSAC with 2 inliers. RANSAC Error. Number of requested inliers is less than min number of elements needed for fit. (2/8)

VW Error: RANSAC was unable to find a fit that matched the supplied data. Traceback (most recent call last): File "/home/brontosaurus/anaconda3/envs/asp/bin/parallel_stereo", line 1086, in normal_run('stereo_pprc', args, msg='%d: Preprocessing' % step) File "/home/brontosaurus/anaconda3/envs/asp/bin/parallel_stereo", line 678, in normal_run raise Exception('Stereo step ' + kw['msg'] + ' failed') Exception: Stereo step 0: Preprocessing failed

I am working on Linux using ISIS 7.2 Ames Stereo Pipeline 3.2.0

Someone who knows how to solve the issue and the reasons?

— Reply to this email directly, view it on GitHub https://github.com/NeoGeographyToolkit/StereoPipeline/issues/395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKDU3F62DHV2Z5PF3BMCRLW7WLMVANCNFSM6AAAAAAWUJH2EI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Pippo-90 commented 1 year ago

Oleg-alexandrov, thank you very much for your reply, however, the pair images should be perfect for creating a proper DEM: they have a pretty good overlap, and both the emission and incident angles are similar, plus the illumination is also similar.

rbeyer commented 1 year ago

All of that sounds great except for the emission angles being similar. These two images have emission angles of 0.09° and 0.34°, which means that the spacecraft was pointed almost straight down (or nadir) when these images were captured. There is no parallax with this pair of images, they are not a stereo pair, and thus terrain cannot be extracted.

Oleg is right, that error is really about the software not finding matches between the images, which is definitely strange, because these two images are very visually similar, so it should have passed through this stage (found lots of matches) and then given you a very bad result later (because there is no parallax with these two images), so I'm not quite sure how it errored here. However, that doesn't matter too much, because the real problem is the lack of parallax.

If you are interested in this area, you will need to find another pairing of images that would make a stereo pair.

oleg-alexandrov commented 1 year ago

Not sure. ASP works usually very reliably with CTX. If you can put the images F02_036536_1906_XN_10N202W.map.cub and G23_027332_1907_XN_10N202W.map.cub somewhere for download, I can try to take a look. Also, your exact ./stereo.default and the command you used. I know the original data is public, but it can take a while to set them up till one gets map.cub files.

Or, you can try another dataset, try without stereo.default (you can delete it), and try without map.cub files, so going back to the original .cub files.