Stereo Vision FAQs
- Updated2023-02-21
- 4 minute(s) read
How do I choose pre-filter settings?
In general, the Sobel filter type provides the best pre-filtering results. Choose None only when computation speed is more important than result quality.
A Filter Size value between 5 to 13 is usually sufficient for satisfactory performance. Smaller values do not allow the high-pass filters used in pre-filtering to perform properly. A Filter Size value that is too large decreases accuracy and increases computation time.
The Filter Cap value limits the largest possible value for pre-filtered images. Setting Filter Cap to less than 32 invokes a more efficient SSE implementation on Windows platforms.
How do I choose post-filter settings?
If the result image is grainy or contains incorrect values, reduce the Speckle Window Size and increase the Speckle Range. For smooth surfaces, a speckle window size of 5 and speckle range of 500 or greater are generally sufficient.
The Texture Threshold and Uniqueness Ratio provide alternate mechanisms to constrain the uniqueness of the disparity value at a given pixel. To remove disparities in non-textured regions, increase the Uniqueness Ratio. Generally, a uniqueness ratio of 5 to 10 is sufficient to remove spurious disparities. Values nearer to 100 are likely to remove valid disparities. To remove disparities in non-textured regions, increase the Texture Threshold. The texture threshold requires the specified level of texture within a predetermined window around the pixel before assigning a disparity value to the pixel. If texture at a given point is below the threshold, the pixel disparity is set to invalid. The texture threshold is not bound to a specific range.
My disparity images are grainy and contain many variations in disparity. How can I obtain smoother disparity images?
There are multiple ways to obtain smoother disparity images:
- Reduce the Speckle Window Size and increase the Speckle Range. For smooth surfaces, a speckle window size of 5 and speckle range of 500 or greater are generally sufficient.
- Specify a minimum disparity value large enough to eliminate very high depth values.
- Increase the correspondence window size to smooth the overall image, including object edges.
- Decrease the Left-Right Check value. Values of 3 to 5 reduce large fluctuations in neighboring disparity values.
- For the semi-global block-matching algorithm, the P1 and P2 parameters control overall smoothness. Larger values increase smoothness. The P1 value should generally be smaller than the P2 value. Typical, respective values are 100, 500; 200, 800; and 100, 800. P1 penalizes, or smooths, neighboring disparity changes of 1. Increasing P1 relative to P2 causes neighboring regions to become more homogenous. P2 penalizes, or smooths, neighboring disparity changes greater than 1. A very large P2 value has the same effect as setting the Left-Right Check value to 1.
My disparity images are smooth, even at object edges. How do I obtain clear disparity changes for object edges?
Adjust the following settings:
- Increase the Left-Right Check to allow for changes in the neighboring disparities.
- Reduce the correspondence window size to increase accuracy.
- If the previous adjustments do not provide sufficient results, increase the speckle window size or decrease the speckle range.
After learning stereo calibration, the rectified images are scaled so that I cannot obtain disparity values for portions of the images that are no longer visible. How can I retain more of the original image information?
Increase the Scaling Factor parameter for the IMAQ Learn Binocular Stereo Calibration VI from 0. A value of 1 constrains the entire rectified image within the dimensions of the original image.
How do I prevent negative depth values in the disparity image?
Make sure that the left and right cameras are configured correctly. Negative depth values are common when the left and right cameras are reversed. Reversed cameras produce a negative offset when moving from the left acquired image to the right acquired image.
How can I reduce memory usage for my stereo vision application?
Set the Learn Lookup Table? option to FALSE. Not learning the lookup table will use less memory, but will also cause the application to run slower.
How do I choose values for the Minimum Disparity and Number of Disparities parameters?
Use the IMAQ Get Maximum Disparity VI to determine the correct value for the Number of Disparities parameter. Subtract the minimum disparity from the maximum disparity produced by the VI to determine the number of disparities. You can also obtain the number of disparities by measuring the disparity between the left and right images for the nearest object and subtracting the minimum disparity.
The Minimum Disparity value must be a multiple of 16. Adjust the minimum disparity to remove incorrect depth values that are very high while retaining the desired maximum depth.
How can I render disparity and depth information relative to the acquired images instead of the rectified images?
Set the Render to Original Image? option to TRUE. Enabling this option increases the computation requirements for the application. Set the Learn Lookup Table? option to TRUE to learn an additional lookup table for the original image; otherwise, application speed decreases significantly.
Rectified images are rotated. How do I set up my stereo vision so that rectified images are closely aligned with original acquired images?
Rotation is expected when there is distance between the cameras along the Y or Z axes. To reduce rotation, mount the cameras in parallel with a horizontal baseline, so that they are separated only along the X axis. If you cannot reposition the cameras, set the Render to Original Image? option to TRUE.