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
492 stars 173 forks source link

dem_mosaic priority_blending and use_centerline_weights #373

Closed rbeyer closed 2 years ago

rbeyer commented 2 years ago

Describe the bug I had two LROC stereo DEMs at 1 m/pixel (A and B) where A had more detail than B. I then had a LOLA gridded data product at 60 m/pixel.

My intention was to "stack" these models in order with A "on top," then B, then LOLA, and I thought I could accomplish this via:

dem_mosaic --priority-blending-length 50 --use-centerline-weights -o out.tif A.tif B.tif LOLA.tif

The dem_mosaic program ran, and seemed to do okay mosaicking A and B, but in the large areas where there were pixels from neither A nor B, there was nodata instead of LOLA data.

Removing --use-centerline-weights in the above command, results in the LOLA data appearing in the output, but the boundaries between A and B (and now between them and LOLA) are much rougher, but this could theoretically be addressed by spending time manually adjusting the blending and weight options.

This isn't a blocking problem for me. Running without --priority-blending-length also and just letting dem_mosaic just blend all of the models actually resulted in a very reasonable model. I was just surprised on running the original command line that there was no hint of LOLA data where it was expected.

Your Environment (please complete the following information):

oleg-alexandrov commented 2 years ago

The root of the problem is that --use-centerline-weights is not the default, but an experimental option, not used in any examples, and its documentation says it is to be used only with DEMs with no holes. While --priority-blending-length implicitly burns holes in non-priority DEMs. The solution here is to disable these two being used together, which I just did.

As to A.tif and B.tif not blending too well, it appears that those two have a non-small mistmatch. I got nicer blending by using --priority-blending-length 100 rather than 50. I got seamless blending by blending these two with no --priority-blending-length.

In your case, since your goal is in fact to use only LOLA.tif as the background DEM, it is best if A.tif and B.tif are just blended the regular way, with no --priority-blending-length, and then use that priority thing with a subsequent invocation of the merged A and B, with now LOLA.tif as the background.

One more thing you can do is along the lines you do now. Just merge all three with regular blending, but then, if you stil want to give A and B higher priority, since they are higher resolution, you can do priority blending between merged A and B on one hand, and merged A, B, and LOLA on the other hand, so the second merged thing is the background. I do understand that this is likely overkill.