Stereo Correspondence

Overview

// classes

class cv::cuda::DisparityBilateralFilter;
class cv::cuda::StereoBM;
class cv::cuda::StereoBeliefPropagation;
class cv::cuda::StereoConstantSpaceBP;

// global functions

Ptr<cuda::DisparityBilateralFilter>
cv::cuda::createDisparityBilateralFilter(
    int ndisp = 64,
    int radius = 3,
    int iters = 1
    );

Ptr<cuda::StereoBeliefPropagation>
cv::cuda::createStereoBeliefPropagation(
    int ndisp = 64,
    int iters = 5,
    int levels = 5,
    int msg_type = CV_32F
    );

Ptr<cuda::StereoBM>
cv::cuda::createStereoBM(
    int numDisparities = 64,
    int blockSize = 19
    );

Ptr<cuda::StereoConstantSpaceBP>
cv::cuda::createStereoConstantSpaceBP(
    int ndisp = 128,
    int iters = 8,
    int levels = 4,
    int nr_plane = 4,
    int msg_type = CV_32F
    );

void
cv::cuda::drawColorDisp(
    InputArray src_disp,
    OutputArray dst_disp,
    int ndisp,
    Stream& stream = Stream::Null()
    );

void
cv::cuda::reprojectImageTo3D(
    InputArray disp,
    OutputArray xyzw,
    InputArray Q,
    int dst_cn = 4,
    Stream& stream = Stream::Null()
    );

Detailed Documentation

Global Functions

Ptr<cuda::DisparityBilateralFilter>
cv::cuda::createDisparityBilateralFilter(
    int ndisp = 64,
    int radius = 3,
    int iters = 1
    )

Creates DisparityBilateralFilter object.

Parameters:

ndisp Number of disparities.
radius Filter radius.
iters Number of iterations.
Ptr<cuda::StereoBeliefPropagation>
cv::cuda::createStereoBeliefPropagation(
    int ndisp = 64,
    int iters = 5,
    int levels = 5,
    int msg_type = CV_32F
    )

Creates StereoBeliefPropagation object.

Parameters:

ndisp Number of disparities.
iters Number of BP iterations on each level.
levels Number of levels.
msg_type Type for messages. CV_16SC1 and CV_32FC1 types are supported.
Ptr<cuda::StereoBM>
cv::cuda::createStereoBM(
    int numDisparities = 64,
    int blockSize = 19
    )

Creates StereoBM object.

Parameters:

numDisparities the disparity search range. For each pixel algorithm will find the best disparity from 0 (default minimum disparity) to numDisparities. The search range can then be shifted by changing the minimum disparity.
blockSize the linear size of the blocks compared by the algorithm. The size should be odd (as the block is centered at the current pixel). Larger block size implies smoother, though less accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher chance for algorithm to find a wrong correspondence.
Ptr<cuda::StereoConstantSpaceBP>
cv::cuda::createStereoConstantSpaceBP(
    int ndisp = 128,
    int iters = 8,
    int levels = 4,
    int nr_plane = 4,
    int msg_type = CV_32F
    )

Creates StereoConstantSpaceBP object.

Parameters:

ndisp Number of disparities.
iters Number of BP iterations on each level.
levels Number of levels.
nr_plane Number of disparity levels on the first level.
msg_type Type for messages. CV_16SC1 and CV_32FC1 types are supported.
void
cv::cuda::drawColorDisp(
    InputArray src_disp,
    OutputArray dst_disp,
    int ndisp,
    Stream& stream = Stream::Null()
    )

Colors a disparity image.

This function draws a colored disparity map by converting disparity values from [0..ndisp) interval first to HSV color space (where different disparity values correspond to different hues) and then converting the pixels to RGB for visualization.

Parameters:

src_disp Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit floating-point disparity image. If 16-bit signed format is used, the values are assumed to have no fractional bits.
dst_disp Output disparity image. It has the same size as src_disp. The type is CV_8UC4 in BGRA format (alpha = 255).
ndisp Number of disparities.
stream Stream for the asynchronous version.
void
cv::cuda::reprojectImageTo3D(
    InputArray disp,
    OutputArray xyzw,
    InputArray Q,
    int dst_cn = 4,
    Stream& stream = Stream::Null()
    )

Reprojects a disparity image to 3D space.

Parameters:

disp Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit floating-point disparity image. If 16-bit signed format is used, the values are assumed to have no fractional bits.
xyzw Output 3- or 4-channel floating-point image of the same size as disp . Each element of xyzw(x,y) contains 3D coordinates (x,y,z) or (x,y,z,1) of the point (x,y) , computed from the disparity map.
Q \(4 \times 4\) perspective transformation matrix that can be obtained via stereoRectify .
dst_cn The number of channels for output image. Can be 3 or 4.
stream Stream for the asynchronous version.

See also:

reprojectImageTo3D