visionworks Semi-Global Matching

Hello, everyone.
Recently, I have been learning sgm algorithm. When I modify the code of llsgm, I have some question.
1.I use nvxFilterCostNode to filter cost with low gradients when the flags is set to 1. Why the nvxFilterCostNode only filter half of an image? What should I do if I want to filter the whole image?

2.What is the principle of this nvxFilterCostNode? Where there are some related papers?

3.For the nvxComputeModifiedCostBTNode, I do not understand the role of this parameter “clip”. Who can explicate it?

Thank you!


  1. From our document, we apply the filter to the whole image rather than half.
    Could you check our document if any wrong input configuration?


  3. output = ( value > clip ) ? clip : value


Thank you for you answer!
1.Even if I use hlsgm, it just filters out half of the image. Maybe you can use white wall images to test hlsgm. I check the documentation again and again. I find extra flags for SGM algorithm: NVX_SGM_FILTER_TOP_AREA, it make nvxFilterCostNode filter cost at top image area with low gradients. And my input configuration:

min_disparity = 0
max_disparity = 128
P1 = 8
P2 = 109
sad = 3
bt_clip_value = 31
max_diff = 1
uniqueness_ratio = 1
scanlines_mask = 255
<b>flags</b> = 3
ct_win_size = 0
hc_win_size = 1

2.I know this paper. I just do not understand the principle of this nvxFilterCostNode. Can give some advice or guidance?
3.How do I set parameters or do something to make the Semi-Global Matching better performance at night scenes?
Thank you again!
disparity.bmp (354 KB)


  1. Maybe you can try to set the flag value to NVX_SGM_PYRAMIDAL_STEREO.

  2. Will update information later.

  3. This parameter targets for avoiding cost overflow. Should be tuned with different algorithm and scenario.



For question No.2, it’s a convolution filter based on P2 and flag.
More algorithm information, please check the paper mentioned in #2.