Hey all,
I am trying to tune my visionworks disparity map, but it keeps throwing the error “VX_ERROR_INVALID_PARAMETERS” when I change a value.
How do I know what the “Valid” parameters are?
Here is the working configuration:
vx_node semi_global_matching_node_ = nvxSemiGlobalMatchingNode(
main_graph_,
left_gray,
right_gray,
disparity_short,
0, // min_disparity
64, // max_disparity
8, // P1
109, // P2
5, // sad
0, // ct_win_size
1, // hc_win_size
31, // bt_clip_value
32000, // max_diff
0, // uniqueness_ratio
85, // scanlines_mask
2); // flags
Changing min_disparity (among other settings) to -16 will cause this error.
Hi,
Semi-global matching algorithm is a single direction stereo matching method to improvement the performance.
Please set min_disparity/max_disparity between [0, 64][0, 256].
Here is a topic for parameters in nvxSemiGlobalMatchingNode() for your reference:
https://devtalk.nvidia.com/default/topic/1023389/disparity-issue/
Thanks.
Thank you. Is there anywhere I can find the min and max values for the rest of the parameters?
Hi,
Sorry that there is some incorrect message in my previous reply.
The min_disparity/max_disparity should be within [0, 256].
You can check our document for the expected range of parameters:
[i]>> VisionWorks API
Samples and Demos
Demo Applications
Stereo Matching Demo App[/i]
[i]…
The file contains the parameters of the stereo matching algorithm.
- min_disparity
- max_disparity
Parameter: [integer value greater or equal to zero and less or equal to 256]
Description: Minimum and maximum disparity values. Defaults are 0 and
Maximum disparity must be divisible by 4.
...
[/i]
Thanks.
I don’t think this issue is quite resolved yet. If I leave everything default and just change
min_disparity=8
I get the same error. Why is this?
It may make more sense if I explain my problem. I have calibrated my stereo images to under 0.2 reprojection error, but when I run disparity mapping on them, the depth map is extremely dark.

I think this could be fixed with min and max disparity
It seems that max-disparity isn’t doing anything. The difference between max-disp=32 and maxdisp = 240 is almost indistinguishable.
And it seems that a min disparity of 8 or 16 also crashes the graph even though it says that it will accept a range of 0-256 in the docs.
If you’re interested, here are my left and right images:


Hi,
Do you know the max/min disparity for your test case?
By the way, please remember that semi-global matching is a single direction search algorithm.
Please make sure you have passed the the image with the corresponding order.
Thanks.
Min disparity has only ever been 0 as any other number will throw an error.
Max disparity has been anywhere from 31 to 255 but it makes almost no difference.
I have fixed the darkness problem by changing “shift” to 1 instead of 4. I am still looking for an answer for the min disparity problem.
Thanks!
Hi,
Could you share the value you set to min disparity?
Please remember that this is a single direction algorithm and the min disparity value is required to be positive.
Thanks.
I set min disparity to 32 and it failed with the error.
Hi,
We can reproduce this issue internally.
Will check with our internal team and update information with you later.
Thanks.
Hi,
You may misuse VisionWorks API and the default parameters should be fine for your use-case.
Based on the images you shared, the reason for “dark” disparity maps and no difference when increasing max disparity is that images have a very small baseline. There is not much different between left and right images so it is expected to find small disparity values in the output. The camera image quality looks pretty bad too. Distorted, and lots of image artifacts.
Please also remember that changing the SGM node parameters will not “fix the dark depth map”. Instead, please adjust how the output disparity map is displayed. One suggestion would be to map [minD, maxD] to [0, 255] with a log scale so disparity values close to the min are stretched more than values close to the max.
More, if the image you shared is a screen grab from the VisionWorks sample app, your camera is reversed (top image should be left camera, bottom should be right).
Thanks.
Thanks. I got it working by changing “shift” from 4 to 1.