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

VW Error: RANSAC was unable to find a fit that matched the supplied data. #415

Closed cyclonebluse closed 2 months ago

cyclonebluse commented 7 months ago

Describe the bug When I use HRSC image to run parallel_stereo ,I get the error:VW Error: RANSAC was unable to find a fit that matched the supplied data.Of course, I refer to the error of Pippo-90https://github.com/NeoGeographyToolkit/StereoPipeline/issues/395, I then tested all the relevant HRSC images for that area but failed,and using images from other areas yielded the correct results. To Reproduce stereo_gui HD674_0000_S12.cub HD674_0000_S22.cub --left-image-crop-win 19 12646 2540 1981 --right-image-crop-win 2 13040 2567 1944 --stereo-algorithm asp_sgm --subpixel-mode 3 run/run

Expected behavior I want to use HRSC images to get topographic information and DEM about the area of interest

Error Logs, Terminal Captures, Screenshots

image

Your Environment (please complete the following information):

Additional context It's also possible that the terrain in this area is too flat and lacks features, but I set ’--corr-seed-mode 0 --corr-max-levels 2‘and it does't work,The topography of the area is roughly as follows. HD674_0000_S12

oleg-alexandrov commented 7 months ago

When you run:

stereo_gui HD674_0000_S12.cub HD674_0000_S22.cub --left-image-crop-win 19 12646 2540 1981 --right-image-crop-win 2 13040 2567 1944 --stereo-algorithm asp_sgm --subpixel-mode 3 run/run

you should see two red rectangles having the areas of interest. Can you share a picture of that screenshot?

My best guess is that the left and right image are not similar enough in those selected areas.

cyclonebluse commented 7 months ago

Thank you for answering my question. It seems to me that the similarity of the selected area is good,Whether use the entire image or crop the image, the same error will be reported.I feel like this doesn't seem to be due to cutting.

image
oleg-alexandrov commented 7 months ago

Good to see the actual area. You can try wiping the entire run directory and rerun with --ip-per-tile 4000. That can be slow but will try to create more matches.

If still no luck, and you can share your two .cub images (on Google drive or something), I can try to reproduce this. (I know the dataset is public but it takes time to get the data, kernels, preprocess it, etc.)

cyclonebluse commented 7 months ago

It's a pity that I've been running for a long time and I'm not getting results,I'll upload the image later. Since the file is too large, I compressed it twice and both can be opened via bandzip The image is stored on my GitHub

oleg-alexandrov commented 7 months ago

Thank you for the data.

The problem is that these images look very different on close-up. Here's a zoomed-in version of the above:

image

I had more luck with a clip higher up, using the command: stereo_gui --stereo-algorithm asp_sgm --subpixel-mode 3 --ip-per-image 10000 --skip-rough-homography --max-disp-spread 200 --left-image-crop-win 838 8335 1643 1500 --right-image-crop-win 786 8404 1673 1831 --corr-seed-mode 1 --threads 16 HD755_0000_S12.cub HD755_0000_S22.cub run/run

image

Here are the clips I used. There is illumination difference.

image

Here are the matches. Still not great.

The resulting DEM looked patchy.

In short, the illumination differences here are larger than what the program can manage. It is easier to throw this out and use other datasets. There should be plenty of HRSC data around.

cyclonebluse commented 7 months ago

Ok, thanks for testing, I can probably see why the error occurred.But I tried the other images in the area (there are only two tracks in this area, D674 and D755), and unfortunately the same error occurred when I ran it, but if I chose a different area, it worked fine.But the strange thing is that the Level 3 data provided by the USGS was made with the D755 track.

cyclonebluse commented 7 months ago

Then I wondered if there was another way to match the type of imagery

oleg-alexandrov commented 7 months ago

I added matches manually, following https://stereopipeline.readthedocs.io/en/latest/tools/stereo_gui.html#edit-interest-point-matches. I had to add around 18 matches or else the tool will complain. Here's an illustration:

image

Then I saved them, as run/run-HD755_0000_S12HD755_0000_S22.match. The file is attached below: [run-HD755_0000_S12HD755_0000_S22.match.zip](https://github.com/NeoGeographyToolkit/StereoPipeline/files/13452608/run-HD755_0000_S12__HD755_0000_S22.match.zip)

Then, quit the gui and run:

stereo --min-num-ip 1 --stereo-algorithm asp_bm --subpixel-mode 1 --skip-rough-homography --max-disp-spread 200 --corr-seed-mode 1 --threads 16 HD755_0000_S12.cub HD755_0000_S22.cub --global-alignment-threshold 1000 run/run

This is working so far, I got: Convergence angle percentiles (in degrees) based on interest point matches: 25% 43.4012, 50% 43.747, 75% 44.4924. D_sub search range: (Origin: (-17.125, -7.75) width: 31.25 height: 17.5) px --> Full-res search range based on D_sub: (Origin: (-93, -50) width: 186 height: 107) Writing: run/run-D.tif --> Correlation :[**......................................] 22%

The search range is a little big but reasonable.

I used here the asp_bm algorithm with stereo. It is suggested to use parallel_stereo, and with the asp_mgm algorithm.

cyclonebluse commented 7 months ago

Thanks for the help and suggestion, next I'll read the above documents carefully and try to add the match points manually and then run stereo, hopefully this will work for that area.

cyclonebluse commented 7 months ago

@oleg-alexandrov Did you get the result successfully?I tried the methods mentioned above, but the DEM results I get seem to be discrete and incomplete.I tried to pick the matching points myself and used parallel_stereo with the asp_mgm algorithm, which ran for a long time but the results didn't seem to be good.When I used stereo, the process of Correlation was lengthy, and at one point it even returned Correlation Failed.Perhaps this is a viable approach, but more experimentation is needed.

oleg-alexandrov commented 7 months ago

The problem is, as before, that the lightning is too different in the two images. I don't know how the other good DEMs for that area were obtained.

You can try to see if there's other HRSC datasets, or even CTX datasets.

cyclonebluse commented 7 months ago

Thank you for your help and advice,Unfortunately, after two days of hard work, I used HiRise imagery this time, but the results in this area were still not satisfactory.This is very strange, the terrain in this area is too smooth and lacks large-scale features, so that it runs for a very long time and the Good-pixel Map looks very discrete,This question does confuse me, but thank you again for your help and for giving me some ideas and solutions to the problem that may be useful in other situations.

oleg-alexandrov commented 7 months ago

Sorry. Really hard to say why things work in other areas and not here. If there are prior DEMs here, one could try to mapproject left and right image onto that DEM and examine those. Mapprojection makes images a lot more similar which makes it easy to understand where their differences or problems are. ASP also can do stereo with mapprojected images if their ground resolution is same.

With stereo, things work poorly in 3 situations: different illumination in the two images, not enough unique but similar texture to correlate between images, small convergence angle.

Maybe one can just give up on this and focus on other regions and later revisit.