Bm algorithm has better results than MGM

98 views
Skip to first unread message

l pp

unread,
Aug 15, 2022, 9:38:24 AM8/15/22
to Ames Stereo Pipeline Support
hi,

I am using satellite images to generate DEM, but the result of BM algorithm is better than MGM algorithm for the same data. Does anyone know why?

The following are the results of BM and MGM algorithms respectively.BM.JPGMGM.JPG

Oleg Alexandrov

unread,
Aug 15, 2022, 11:46:18 AM8/15/22
to l pp, Ames Stereo Pipeline Support
It is kind of hard to say that BM is better than MGM. Both have holes, which is very usual in mountainous terrain. You can try, per the doc, to create this DEM (by whichever method), at lower resolution, fill holes in it, mapproject onto it, and redo stereo with mapprojected images. It should close the remaining holes. I will also suggest to hillshade the DEMs and zoom in, to see which method has more detail. 

--
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 ames-stereo-pipeline...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ames-stereo-pipeline-support/e6ec8e42-4b8b-4ff8-8a0f-0a6a30156db4n%40googlegroups.com.

l pp

unread,
Aug 15, 2022, 10:52:20 PM8/15/22
to Ames Stereo Pipeline Support

Thank you for your quick reply

I think MGM algorithm should be better in theory, but it turns out that the result of MGM algorithm has lost a lot of details, while the result of BM algorithm has been made, so I think the result of BM algorithm is better. And I want the DEM to have a higher resolution, so I'm not using mapproject

Oleg Alexandrov

unread,
Aug 16, 2022, 12:30:55 AM8/16/22
to l pp, Ames Stereo Pipeline Support


And I want the DEM to have a higher resolution, so I'm not using mapproject


One mapprojects onto a low-resolution DEM to make the left and right images agree better. The resolution of the mapprojected images and the resolution of the final DEM are the same as if no mapprojection was used. The only consequence of mapprojection is that likely correlation will succeed better in steep areas. 


 

在2022年8月15日星期一 UTC+8 23:46:18<oleg.al...@gmail.com> 写道:
It is kind of hard to say that BM is better than MGM. Both have holes, which is very usual in mountainous terrain. You can try, per the doc, to create this DEM (by whichever method), at lower resolution, fill holes in it, mapproject onto it, and redo stereo with mapprojected images. It should close the remaining holes. I will also suggest to hillshade the DEMs and zoom in, to see which method has more detail. 

On Mon, Aug 15, 2022 at 6:38 AM l pp <pplau...@gmail.com> wrote:
hi,

I am using satellite images to generate DEM, but the result of BM algorithm is better than MGM algorithm for the same data. Does anyone know why?

The following are the results of BM and MGM algorithms respectively.BM.JPGMGM.JPG

--
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 ames-stereo-pipeline...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ames-stereo-pipeline-support/e6ec8e42-4b8b-4ff8-8a0f-0a6a30156db4n%40googlegroups.com.

--
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 ames-stereo-pipeline...@googlegroups.com.

Amaury Dehecq

unread,
Aug 24, 2022, 2:26:24 AM8/24/22
to Ames Stereo Pipeline Support
Hi,

it does look like the resolution of your MGM DEM is lower indeed, but it is difficult to understand why with just the images. Could you please send the parallel_stereo and point2dem commands that you used?

Amaury

l pp

unread,
Aug 28, 2022, 9:59:27 PM8/28/22
to Ames Stereo Pipeline Support
hi, Amaury
I'm sorry to see the message until now, my call command is as follows

bm:

stereo -t rpc --alignment-method affineepipolar --stereo-algorithm asp_bm  
--subpixel-mode 3 L.tiff R.tiff L.xml R.xml run/out

point2dem out-PC.tif -o run/out --search-radius-factor 5 --dem-hole-fill-len 500 --nodata-value -9999

mgm:

parallel_stereo -t rpc --alignment-method local_epipolar --stereo-algorithm asp_mgm  
--subpixel-mode 3 L.tiff R.tiff L.xml R.xml run/out

point2dem out-PC.tif -o run/out --search-radius-factor 5 --dem-hole-fill-len 500 --nodata-value -9999


Amaury Dehecq

unread,
Aug 30, 2022, 9:56:43 AM8/30/22
to Ames Stereo Pipeline Support
Hi,

Ok I see. First of all, it is recommended to use parallel_stereo rather than stereo. I think the latter will be deprecated and does not have all the functionalities of parallel_stereo.
Second, SGM/MGM already contain a subpixel refinment, so it is not a common to use --subpixel-mode 3 with it. I would try removing that argument and leave the default value to see if it solves your issue.
Finally, I see that you used --dem-hole-fill-len in poitn2dem. I would also use the default here (which is no filling) first to get an idea of how the DEMs look like. Maybe your issue is that you have many gaps with MGM and then you are filling them, which could explain why they seem to have a poor resolution.
I would also recommend you to look at the log files generated by stereo and point2dem to check the output.

Amaury

David Shean

unread,
Aug 30, 2022, 12:18:45 PM8/30/22
to Amaury Dehecq, Ames Stereo Pipeline Support
I recommend dropping the --search-radius-factor 5 flag as well, as that can effectively “blur” features.  Should be plenty of points within the standard 1-pixel radius.



--
David Shean
Civil and Environmental Engineering
University of Washington
https://www.ce.washington.edu/facultyfinder/david-shean 

201 More Hall, Box 352700
3760 E. Stevens Way NE
Seattle, WA 98195-2700
Office: (206) 543-3105, Wilcox Hall 265
Pronouns: he, him, his

l pp

unread,
Aug 30, 2022, 10:48:48 PM8/30/22
to Ames Stereo Pipeline Support
However, after removing -- search-radius-factor 5 flag, the generated DEM will have a lot of holes.

Alexandrov, Oleg (ARC-TI)[KBR Wyle Services, LLC]

unread,
Aug 30, 2022, 10:54:09 PM8/30/22
to l pp, Ames Stereo Pipeline Support
Normally a DEM should not have a lot of holes. I will suggest examine the left and right images. The asm_mgm algorithm is in fact a little to eager to fill in areas, and if even that one leaves holes, that is likely a symptom of something not being right with your dataset. 

From: ames-stereo-pi...@googlegroups.com <ames-stereo-pi...@googlegroups.com> on behalf of l pp <pplau...@gmail.com>
Sent: Tuesday, August 30, 2022 7:48 PM
To: Ames Stereo Pipeline Support <ames-stereo-pi...@googlegroups.com>
Subject: [EXTERNAL] Re: Bm algorithm has better results than MGM
 

David Shean

unread,
Aug 31, 2022, 1:20:47 AM8/31/22
to Oleg Alexandrov, l pp, Ames Stereo Pipeline Support
If you’re seeing lots of small holes, consider setting the output grid cell size as factor of 2x the native image GSD using the `—tr` flag.  Maybe even 3x.  You can experiment with `—filter count` to assess point density for different output DEM grid cell sizes, and choose a value that balances detail with potential gaps.  


On Aug 30, 2022, at 7:54 PM, 'Alexandrov, Oleg (ARC-TI)[KBR Wyle Services, LLC]' via Ames Stereo Pipeline Support <ames-stereo-pi...@googlegroups.com> wrote:

Normally a DEM should not have a lot of holes. I will suggest examine the left and right images. The asm_mgm algorithm is in fact a little to eager to fill in areas, and if even that one leaves holes, that is likely a symptom of something not being right with your dataset. 

From: ames-stereo-pi...@googlegroups.com <ames-stereo-pi...@googlegroups.com> on behalf of l pp <pplau...@gmail.com>
Sent: Tuesday, August 30, 2022 7:48 PM
To: Ames Stereo Pipeline Support <ames-stereo-pi...@googlegroups.com>
Subject: [EXTERNAL] Re: Bm algorithm has better results than MGM
 
However, after removing -- search-radius-factor 5 flag, the generated DEM will have a lot of holes.

在2022年8月31日星期三 UTC+8 00:18:45<dsh...@uw.edu> 写道:
I recommend dropping the --search-radius-factor 5 flag as well, as that can effectively “blur” features.  Should be plenty of points within the standard 1-pixel radius.



--
David Shean
Civil and Environmental Engineering
University of Washington


201 More Hall, Box 352700
3760 E. Stevens Way NE
Seattle, WA 98195-2700
Office: (206) 543-3105, Wilcox Hall 265
Pronouns: he, him, his
On Aug 30, 2022, at 6:56 AM, Amaury Dehecq <amaury...@gmail.com> wrote:

Hi,

Ok I see. First of all, it is recommended to use parallel_stereo rather than stereo. I think the latter will be deprecated and does not have all the functionalities of parallel_stereo.
Second, SGM/MGM already contain a subpixel refinment, so it is not a common to use --subpixel-mode 3 with it. I would try removing that argument and leave the default value to see if it solves your issue.
Finally, I see that you used --dem-hole-fill-len in poitn2dem. I would also use the default here (which is no filling) first to get an idea of how the DEMs look like. Maybe your issue is that you have many gaps with MGM and then you are filling them, which could explain why they seem to have a poor resolution.
I would also recommend you to look at the log files generated by stereo and point2dem to check the output.

Amaury


-- 
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 ames-stereo-pipeline...@googlegroups.com.

-- 
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 ames-stereo-pipeline...@googlegroups.com.

-- 
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 ames-stereo-pipeline...@googlegroups.com.

-- 
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 ames-stereo-pipeline...@googlegroups.com.

l pp

unread,
Aug 31, 2022, 10:33:59 PM8/31/22
to Ames Stereo Pipeline Support


Thank you all for your advice. I will try your advice.

christina Toldbo

unread,
Sep 8, 2022, 5:50:46 PM9/8/22
to Ames Stereo Pipeline Support
Although not related to holes I also seem to get 'worse' results with MGM than with BM?

Is MGM always to be preferred (for quality) or can BM sometimes be better? When I generate a DEM using the standard stereo.default file (using bm) I get better results than with the command from the documentation: parallel_stereo {left} {right} --stereo-algorithm asp_mgm --corr-kernel 5 5 --cost-mode 4 --median-filter-size 3  --texture-smooth-size 11 --texture-smooth-scale 0.13 {resultFolderMGM} 

point2dem file-PC.tif


I also tried omitting the median-filter-size, --texture-smooth-size and --texture-smooth-scale but it says in the documentation that these must be disabled manually (how is that done?)

See attached BM_DEM and MGM_DEM



MGM_DEM.png
BM_DEM.png

Scott McMichael

unread,
Sep 8, 2022, 6:08:06 PM9/8/22
to christina Toldbo, Ames Stereo Pipeline Support
BM can sometimes work better but it is less resilient to poor image quality and noise than MGM.  Looking at that image pair I think the issue may be that the MGM built-in subpixel step is not doing as good a job with the images as the default BM subpixel algorithm.  If you are happy with the BM result you can use that, otherwise you may want to try running MGM with --subpixel-mode 2 or 3 and see how that works.

Scott

Reply all
Reply to author
Forward
0 new messages