Class cv::cuda::StereoBeliefPropagation#

Class computing stereo correspondence using the belief propagation algorithm. : View details

Collaboration diagram for cv::cuda::StereoBeliefPropagation:

Public Member Functions#

Public Member Functions inherited from cv::Algorithm

Return

Name

Description

Algorithm()

~Algorithm()

void

clear()

Clears the algorithm state.

bool

empty()

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.

String

getDefaultName()

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

save(const String & filename)

void

write(
    const Ptr< FileStorage > & fs,
    const String & name = String() )

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Static Public Member Functions#

Static Public Member Functions inherited from cv::Algorithm

Return

Name

Description

static Ptr< _Tp >

load(
    const String & filename,
    const String & objname = String() )

Loads algorithm from the file.

static Ptr< _Tp >

loadFromString(
    const String & strModel,
    const String & objname = String() )

Loads algorithm from a String.

static Ptr< _Tp >

read(const FileNode & fn)

Reads algorithm from the file node.

Additional Inherited Members#

Protected Member Functions inherited from cv::Algorithm

Return

Name

Description

void

writeFormat(FileStorage & fs)

Detailed Description#

Class computing stereo correspondence using the belief propagation algorithm. :

The class implements algorithm described in Felzenszwalb2006 . It can compute own data cost (using a truncated linear model) or use a user-provided data cost.

\[width \_ step \cdot height \cdot ndisp \cdot 4 \cdot (1 + 0.25)\]

and for data cost storage:

\[width\_step \cdot height \cdot ndisp \cdot (1 + 0.25 + 0.0625 + \dotsm + \frac{1}{4^{levels}})\]

width_step is the number of bytes in a line including padding.

StereoBeliefPropagation uses a truncated linear model for the data cost and discontinuity terms:

\[DataCost = data \_ weight \cdot \min ( \lvert Img_Left(x,y)-Img_Right(x-d,y) \rvert , max \_ data \_ term)\]

\[DiscTerm = \min (disc \_ single \_ jump \cdot \lvert f_1-f_2 \rvert , max \_ disc \_ term)\]

For more details, see Felzenszwalb2006 .

By default, StereoBeliefPropagation uses floating-point arithmetics and the CV_32FC1 type for messages. But it can also use fixed-point arithmetics and the CV_16SC1 message type for better performance. To avoid an overflow in this case, the parameters must satisfy the following requirement:

\[10 \cdot 2^{levels-1} \cdot max \_ data \_ term < SHRT \_ MAX\]

See also

StereoMatcher

Note

StereoBeliefPropagation requires a lot of memory for message storage:

Member Function Documentation#

compute()#

void cv::cuda::StereoBeliefPropagation::compute(
InputArray data,
OutputArray disparity,
Stream & stream = Stream::Null() )

Enables the stereo correspondence operator that finds the disparity for the specified data cost.

Parameters

  • data — User-specified data cost, a matrix of msg_type type and Size(*ndisp, ) size.

  • disparity — Output disparity map. If disparity is empty, the output type is CV_16SC1 . Otherwise, the type is retained. In 16-bit signed format, the disparity values do not have fractional bits.

  • streamStream for the asynchronous version.

compute()#

void cv::cuda::StereoBeliefPropagation::compute(
InputArray left,
InputArray right,
OutputArray disparity,
Stream & stream )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

getDataWeight()#

double cv::cuda::StereoBeliefPropagation::getDataWeight()

data weight

getDiscSingleJump()#

double cv::cuda::StereoBeliefPropagation::getDiscSingleJump()

discontinuity single jump

getMaxDataTerm()#

double cv::cuda::StereoBeliefPropagation::getMaxDataTerm()

truncation of data cost

getMaxDiscTerm()#

double cv::cuda::StereoBeliefPropagation::getMaxDiscTerm()

truncation of discontinuity cost

getMsgType()#

int cv::cuda::StereoBeliefPropagation::getMsgType()

type for messages (CV_16SC1 or CV_32FC1)

getNumIters()#

int cv::cuda::StereoBeliefPropagation::getNumIters()

number of BP iterations on each level

getNumLevels()#

int cv::cuda::StereoBeliefPropagation::getNumLevels()

number of levels

setDataWeight()#

void cv::cuda::StereoBeliefPropagation::setDataWeight(double data_weight)

setDiscSingleJump()#

void cv::cuda::StereoBeliefPropagation::setDiscSingleJump(double disc_single_jump)

setMaxDataTerm()#

void cv::cuda::StereoBeliefPropagation::setMaxDataTerm(double max_data_term)

setMaxDiscTerm()#

void cv::cuda::StereoBeliefPropagation::setMaxDiscTerm(double max_disc_term)

setMsgType()#

void cv::cuda::StereoBeliefPropagation::setMsgType(int msg_type)

setNumIters()#

void cv::cuda::StereoBeliefPropagation::setNumIters(int iters)

setNumLevels()#

void cv::cuda::StereoBeliefPropagation::setNumLevels(int levels)

estimateRecommendedParams()#

static void cv::cuda::StereoBeliefPropagation::estimateRecommendedParams(
int width,
int height,
int & ndisp,
int & iters,
int & levels )

Uses a heuristic method to compute the recommended parameters ( ndisp, iters and levels ) for the specified image size ( width and height ).

Source file#

The documentation for this class was generated from the following file: