NI Vision for LabVIEW

IMAQ Stereo Correspondence (Block Matching) VI

  • Updated2023-02-21
  • 7 minute(s) read
Owning Palette: Locate Edges
Requires: NI Vision Development Module

Computes the disparity map for a pair of stereo images using a block matching method. This VI will implement the entire 3D reconstruction process internally until the disparity information is available. That is the VI will internally rectify the left and right images and then use the rectified images to compute the disparity information.

Examples

IMAQ Stereo Correspondence (Block Matching)

cbool.gif

Process Band?, if TRUE, ignores the Minimum Disparity and Number of Disparities values, and processes the entire image to compute the disparity. Depending on the overlap between the left image and the right image, the interpolated disparities in the overlap area may not be correct. When FALSE, the overlap area is replaced with the invalid pixel value. The default value is FALSE (off).

cnclst.gif

Postfilter Options specifies how the disparity information obtained from stereo correspondence is improved.

cu32.gif

Texture Threshold specifies the minimum sum of absolute value (SAD) at each pixel to be considered to be a valid disparity.

cu32.gif

Uniqueness Ratio specifies how unique the match at each pixel should be to considered as valid.

cu32.gif

Speckle Window Size specifies the maximum allowed deviation in neighboring pixels disparity values. The speckle window size defines the following interval: [current disparity - (speckle window size x scaling factor), current disparity + (speckle window size x scaling factor)], where the scaling factor equals 16. For example, if the current disparity is 128 and the speckle window size is 5, then the speckle window size defines an interval [48, 208].

cu32.gif

Speckle Range defines the number of neighboring pixel disparities the speckle filter must locate before a given pixel disparity is considered valid. A pixel disparity is valid if the value falls within the interval defined in Speckle Window Size.

cnclst.gif

Prefilter Options specifies how the image is conditioned before stereo correspondence is performed.

cu32.gif

Filter Type specifies the type of filtering operation that is applied to the input images.

cu32.gif

Filter Size specifies the size of the filter. It must be odd.

cu32.gif

Filter Cap specifies the filter cap.

crn.gif

Binocular Stereo Session is the reference to the binocular stereo vision session on which this VI operates.

cgenclasstagrefflat.gif

Left Image In is the reference to the input image from the left camera in the binocular stereo system.

cgenclasstagrefflat.gif

Right Image In is the reference to the input image from the right camera in the binocular stereo system.

cgenclasstagrefflat.gif

Disparity Image In is the reference to the image that will contain the disparity information after the VI runs.

cerrcodeclst.gif

error in (no error) describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.

cbool.gif

status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.

ci32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

cstr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

cgenclasstagrefflat.gif

Score Image In is the reference to the image that will contain the score information associated with the disparity image after the VI runs.

ccclst.gif

Correspondence Options specifies how the block matching algorithm will work for computing the disparity information using stereo correspondence.

cu32.gif

Method specifies the metric that is used to compute matches between the left and right images. Currently only the sum of absolute differences (SAD) is supported.

cu32.gif

Window Size is the size of the window that is used to compute the matching score at each pixel in the image.

ci32.gif

Minimum Disparity is the minimum distance between the same point in the left and right rectified images.

cu32.gif

Number of Disparities is the maximum distance (disparity) between the same point in the left and right rectified images. You can use the IMAQ Get Maximum Disparity 2 VI to compute this value if you know the minimum depth of the object under inspection from the camera.

ci32.gif

Max Left Right Disparity Change specifies the maximum allowed difference in the disparity value of a pixel with the disparity values of pixels immediately to its left and right. If the difference in disparity is greater than this value, then the pixel is set to have an invalid disparity.

cbool.gif

Subpixel computes the disparities with subpixel accuracy when enabled. Bilinear interpolation is used to compute disparities with subpixel accuracy.

csgl.gif

Invalid Disparity Replace Value is the pixel value assigned to invalid disparity values in the output Disparity Image. Use the same value that is used here with the IMAQ Stereo Correspondence (Block Matching) VI or the IMAQ Stereo Correspondence (SG Block Matching) VI.

irn.gif

Binocular Stereo Session (dup) is the reference to the stereo vision session on which this VI operates.

igenclasstagrefflat.gif

Disparity Image Out is the reference to the output image that contains the computed disparity values.

igenclasstagrefflat.gif

Score Image Out is the reference to the output image that contains the scores associated with disparity values returned in Disparity Image Out. Each pixel in the image contains a value between 0 and 1000. A value of 1000 indicates full confidence in the computed disparity value at that pixel coordinates. A value of 0 indicates no confidence in the computed disparity value.

ierrcodeclst.gif

error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.

ibool.gif

status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.

ii32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

istr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

Examples

Refer to the following for examples that use this VI.

  • LabVIEW\examples\Vision\Stereo Vision\Compute Depth Image\Compute Depth Image.vi