remove lateral points

Skip to first unread message

Mauro S

Aug 3, 2022, 1:55:43 PMAug 3
to Ames Stereo Pipeline Support
HI there,

I got a very descent DEM, but with lots of "lateral" points.
Is there a suggested way to remove them? I guess:
- I could try to crop the area (althoug it is always square so I will loose par of the DEM) 
- Or try --max-valid-triangulation-error , although some of those have better value than the central area.

Any suggestion?
Captura de pantalla 2022-08-03 150441.png

Oleg Alexandrov

Aug 3, 2022, 2:04:31 PMAug 3
to Mauro S, Ames Stereo Pipeline Support
You should get less such noise with --stereo-algorithm asp_mgm, and also with mapprojection. These options are discussed here:

You can also try eroding those points with dem_mosaic --erode-length. 

You received this message because you are subscribed to the Google Groups "Ames Stereo Pipeline Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Mauro S

Aug 4, 2022, 8:57:30 AMAug 4
to Ames Stereo Pipeline Support
Thank you Oleg for your patience!

I think I did it using asp_mgm and subpixel mode 2. At least I put that at the stereo.default file. I will check that indeed run the options from the file and did not run the default options.

Now I have another question,. The images are HIRISEs, as for the example I run hiedr2mosaic --> cam2map4stereo --> parallel_stereo--> point2dem.

One possible way to improve the quality would be introducing bundle A., right? Should I do it after hiedr2mosaic and before cam2map4stereo or after cam2map4stereo? oris it the same?

Oleg Alexandrov

Aug 4, 2022, 12:52:20 PMAug 4
to Mauro S, Ames Stereo Pipeline Support
The cam2map4stereo tool is incompatible with bundle adjustment. It creates cam2map-ed images but can't use the results of bundle_adjust. And after this tool runs, it is too late to do bundle adjustment as the images are already projected. If you use bundle_adjust first, cam2map4stereo can't use its results. These were too divergent paths which were added to our codebase at different times and are not easy to reconcile since the cam2map approach uses ISIS logic directly, and the other one does not.

What one can do is first use bundle_adjust then parallel_stereo with resulting adjustments, without cam2map.

Now, bundle_adjust will likely not be able to remove that extra noise you see. You may want to understand where it comes from. Maybe something on the ground is hard to match between the two images. If the noise is also in the disparity, so in RD.tif, note that there are some erosion parameters for removing small blobs also in stereo_fltr ( 

Mauro S

Aug 9, 2022, 12:40:53 PMAug 9
to Ames Stereo Pipeline Support
Hello Oleg,

Following this issue, To improve the DEM now I used bundle adjustment. So:
From HIRISE EDR I run: 
>>bundle_adjust --datum D_MARS R.mos_hijitreged.norm.cub  L.mos_hijitreged.norm.cub   -o bahirise/BA
>> parallel_stereo  R.mos_hijitreged.norm.cub   L.mos_hijitreged.norm.cub  run_adjust/run  --bundle-adjust-prefix run_ba/run
>>point2dem -r mars  run-PC.tif --errorimage  --t_srs "+proj=eqc +lat_0=0 +lon_0=0 +a=3396190 +b=3396190 +units=m +no_defs" --dem-hole-fill-len 200 --orthoimage-hole-fill-len 200 --orthoimage snorth-L.tif -o final/LR

That worked fine. Now I would like to improve the DEM by using that result. So I wantented to try projecting the  R.mos_hijitreged.norm.cub and L.mos_hijitreged.norm.cub to that low res dem and re-run the parallel stereo with those mapprojected images

I tried
>>mapproject -t isis LR-DEM.tif  L.mos_hijitreged.norm.cub  run_adjust/run   --bundle-adjust-prefix bahirise/BA

but I get this error

Error: **ERROR** Unable to initialize camera model in Camera Factory.

**PROGRAMMER ERROR** Unable to create a shape model from given target and pvl.

**I/O ERROR** Invalid shape model file [$base/dems/molaMarsPlanetaryRadius0005.cub] in Kernels group.

**ERROR** The given shape model file is not a valid ISIS DEM. Unable to open as an ISIS cube.

**I/O ERROR** Unable to open [/media/pelinor/1C99B87F5E57EE7C/dataisis/base/dems/molaMarsPlanetaryRadius0005.cub].

**ERROR** The given shape model file is not a valid NAIF DSK file. Unable to construct a NAIF DSK shape model.

**USER ERROR** NAIF DSK file [$base/dems/molaMarsPlanetaryRadius0005.cub] does not exist.

    --> Setting number of processing threads to: 4

Using session: isis

Loading camera model:  L.mos_hijitreged.norm.cub 

Error computing projected area, quitting!

What I am missing?

Oleg Alexandrov

Aug 9, 2022, 12:48:37 PMAug 9
to Mauro S, Ames Stereo Pipeline Support
>>mapproject -t isis LR-DEM.tif  L.mos_hijitreged.norm.cub  run_adjust/run   --bundle-adjust-prefix bahirise/BA

The string "run_adjust/run" seems out of place. Per, one should have the DEM, .cub file, and output .tif file. Then also --bundle-adjust-prefix too. 

Mauro S

Aug 10, 2022, 8:01:59 AMAug 10
to Ames Stereo Pipeline Support
Ok, this was solved. It was a path issue. The solution was setting properly the path to isis data.
Just one comment, for this particular case of mapproject I also run into the error of reading the coordinate properly that was also solved setting:

export LC_ALL=en_US.UTF-8

export LANG=en_US.UTF-8

export LC_TIME=en_US.UTF-8

But it might be because I´m using a very old UBUNTU 14.04.

Oleg Alexandrov

Aug 10, 2022, 12:18:11 PMAug 10
to Mauro S, Ames Stereo Pipeline Support
If you get the latest Linux build from then you don't need to set those variables. Note that what is at that location is a tar archive, not a conda build, so it needs to be fetched and extracted, per There is also no OSX version for now. 

Reply all
Reply to author
0 new messages