@Namespace(value="cv::cuda") @Properties(inherit=opencv_cudastereo.class) public class StereoBeliefPropagation extends StereoMatcher
The class implements algorithm described in \cite Felzenszwalb2006 . It can compute own data cost (using a truncated linear model) or use a user-provided data cost.
\note StereoBeliefPropagation requires a lot of memory for message storage:
\[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 \cite 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\]
StereoMatcherPointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounterDISP_SCALE, DISP_SHIFT| Constructor and Description |
|---|
StereoBeliefPropagation(Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
compute(GpuMat data,
GpuMat disparity) |
void |
compute(GpuMat left,
GpuMat right,
GpuMat disparity,
Stream stream) |
void |
compute(GpuMat data,
GpuMat disparity,
Stream stream) |
void |
compute(Mat data,
Mat disparity) |
void |
compute(Mat left,
Mat right,
Mat disparity,
Stream stream)
\overload
|
void |
compute(Mat data,
Mat disparity,
Stream stream)
\brief Enables the stereo correspondence operator that finds the disparity for the specified data cost.
|
void |
compute(UMat data,
UMat disparity) |
void |
compute(UMat data,
UMat disparity,
Stream stream) |
void |
compute(UMat left,
UMat right,
UMat disparity,
Stream stream) |
static void |
estimateRecommendedParams(int width,
int height,
int[] ndisp,
int[] iters,
int[] levels) |
static void |
estimateRecommendedParams(int width,
int height,
IntBuffer ndisp,
IntBuffer iters,
IntBuffer levels) |
static void |
estimateRecommendedParams(int width,
int height,
IntPointer ndisp,
IntPointer iters,
IntPointer levels)
\brief Uses a heuristic method to compute the recommended parameters ( ndisp, iters and levels ) for the
specified image size ( width and height ).
|
double |
getDataWeight()
data weight
|
double |
getDiscSingleJump()
discontinuity single jump
|
double |
getMaxDataTerm()
truncation of data cost
|
double |
getMaxDiscTerm()
truncation of discontinuity cost
|
int |
getMsgType()
type for messages (CV_16SC1 or CV_32FC1)
|
int |
getNumIters()
number of BP iterations on each level
|
int |
getNumLevels()
number of levels
|
void |
setDataWeight(double data_weight) |
void |
setDiscSingleJump(double disc_single_jump) |
void |
setMaxDataTerm(double max_data_term) |
void |
setMaxDiscTerm(double max_disc_term) |
void |
setMsgType(int msg_type) |
void |
setNumIters(int iters) |
void |
setNumLevels(int levels) |
compute, compute, compute, getBlockSize, getDisp12MaxDiff, getMinDisparity, getNumDisparities, getSpeckleRange, getSpeckleWindowSize, setBlockSize, setDisp12MaxDiff, setMinDisparity, setNumDisparities, setSpeckleRange, setSpeckleWindowSizeclear, empty, getDefaultName, position, read, save, save, write, write, writeaddress, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zeropublic StereoBeliefPropagation(Pointer p)
Pointer.Pointer(Pointer).public void compute(@ByVal Mat left, @ByVal Mat right, @ByVal Mat disparity, @ByRef Stream stream)
public void compute(@ByVal UMat left, @ByVal UMat right, @ByVal UMat disparity, @ByRef Stream stream)
public void compute(@ByVal GpuMat left, @ByVal GpuMat right, @ByVal GpuMat disparity, @ByRef Stream stream)
public void compute(@ByVal Mat data, @ByVal Mat disparity, @ByRef(nullValue="cv::cuda::Stream::Null()") Stream stream)
data - User-specified data cost, a matrix of msg_type type and
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.stream - Stream for the asynchronous version.public void compute(@ByVal UMat data, @ByVal UMat disparity, @ByRef(nullValue="cv::cuda::Stream::Null()") Stream stream)
public void compute(@ByVal GpuMat data, @ByVal GpuMat disparity, @ByRef(nullValue="cv::cuda::Stream::Null()") Stream stream)
public int getNumIters()
public void setNumIters(int iters)
public int getNumLevels()
public void setNumLevels(int levels)
public double getMaxDataTerm()
public void setMaxDataTerm(double max_data_term)
public double getDataWeight()
public void setDataWeight(double data_weight)
public double getMaxDiscTerm()
public void setMaxDiscTerm(double max_disc_term)
public double getDiscSingleJump()
public void setDiscSingleJump(double disc_single_jump)
public int getMsgType()
public void setMsgType(int msg_type)
public static void estimateRecommendedParams(int width,
int height,
@ByRef
IntPointer ndisp,
@ByRef
IntPointer iters,
@ByRef
IntPointer levels)
public static void estimateRecommendedParams(int width,
int height,
@ByRef
IntBuffer ndisp,
@ByRef
IntBuffer iters,
@ByRef
IntBuffer levels)
Copyright © 2020. All rights reserved.