|
OpenCV 2.4.3 (RC) | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opencv.calib3d.StereoSGBM
public class StereoSGBM
Class for computing stereo correspondence using the semi-global block matching algorithm.
class StereoSGBM
// C++ code:
StereoSGBM();
StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize,
int P1=0, int P2=0, int disp12MaxDiff=0,
int preFilterCap=0, int uniquenessRatio=0,
int speckleWindowSize=0, int speckleRange=0,
bool fullDP=false);
virtual ~StereoSGBM();
virtual void operator()(InputArray left, InputArray right, OutputArray disp);
int minDisparity;
int numberOfDisparities;
int SADWindowSize;
int preFilterCap;
int uniquenessRatio;
int P1, P2;
int speckleWindowSize;
int speckleRange;
int disp12MaxDiff;
bool fullDP;...
};
The class implements the modified H. Hirschmuller algorithm [HH08] that differs from the original one as follows:
fullDP=true
to run
the full variant of the algorithm but beware that it may consume a lot of
memory.
SADWindowSize=1
reduces the blocks to single pixels.
CV_STEREO_BM_XSOBEL
type) and post-filtering (uniqueness check,
quadratic interpolation and speckle filtering).
Field Summary | |
---|---|
static int |
DISP_SCALE
|
static int |
DISP_SHIFT
|
protected long |
nativeObj
|
Constructor Summary | |
---|---|
|
StereoSGBM()
Initializes StereoSGBM and sets parameters to custom values.?? |
|
StereoSGBM(int minDisparity,
int numDisparities,
int SADWindowSize)
Initializes StereoSGBM and sets parameters to custom values.?? |
|
StereoSGBM(int minDisparity,
int numDisparities,
int SADWindowSize,
int P1,
int P2,
int disp12MaxDiff,
int preFilterCap,
int uniquenessRatio,
int speckleWindowSize,
int speckleRange,
boolean fullDP)
Initializes StereoSGBM and sets parameters to custom values.?? |
protected |
StereoSGBM(long addr)
|
Method Summary | |
---|---|
void |
compute(Mat left,
Mat right,
Mat disp)
|
protected void |
finalize()
|
int |
get_disp12MaxDiff()
|
boolean |
get_fullDP()
|
int |
get_minDisparity()
|
int |
get_numberOfDisparities()
|
int |
get_P1()
|
int |
get_P2()
|
int |
get_preFilterCap()
|
int |
get_SADWindowSize()
|
int |
get_speckleRange()
|
int |
get_speckleWindowSize()
|
int |
get_uniquenessRatio()
|
void |
set_disp12MaxDiff(int disp12MaxDiff)
|
void |
set_fullDP(boolean fullDP)
|
void |
set_minDisparity(int minDisparity)
|
void |
set_numberOfDisparities(int numberOfDisparities)
|
void |
set_P1(int P1)
|
void |
set_P2(int P2)
|
void |
set_preFilterCap(int preFilterCap)
|
void |
set_SADWindowSize(int SADWindowSize)
|
void |
set_speckleRange(int speckleRange)
|
void |
set_speckleWindowSize(int speckleWindowSize)
|
void |
set_uniquenessRatio(int uniquenessRatio)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DISP_SCALE
public static final int DISP_SHIFT
protected final long nativeObj
Constructor Detail |
---|
public StereoSGBM()
Initializes StereoSGBM
and sets parameters to custom values.??
The first constructor initializes StereoSGBM
with all the
default parameters. So, you only have to set StereoSGBM.numberOfDisparities
at minimum. The second constructor enables you to set each parameter to a
custom value.
public StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize)
Initializes StereoSGBM
and sets parameters to custom values.??
The first constructor initializes StereoSGBM
with all the
default parameters. So, you only have to set StereoSGBM.numberOfDisparities
at minimum. The second constructor enables you to set each parameter to a
custom value.
minDisparity
- Minimum possible disparity value. Normally, it is zero
but sometimes rectification algorithms can shift images, so this parameter
needs to be adjusted accordingly.numDisparities
- Maximum disparity minus minimum disparity. The value is
always greater than zero. In the current implementation, this parameter must
be divisible by 16.SADWindowSize
- Matched block size. It must be an odd number
>=1
. Normally, it should be somewhere in the 3..11
range.public StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, boolean fullDP)
Initializes StereoSGBM
and sets parameters to custom values.??
The first constructor initializes StereoSGBM
with all the
default parameters. So, you only have to set StereoSGBM.numberOfDisparities
at minimum. The second constructor enables you to set each parameter to a
custom value.
minDisparity
- Minimum possible disparity value. Normally, it is zero
but sometimes rectification algorithms can shift images, so this parameter
needs to be adjusted accordingly.numDisparities
- Maximum disparity minus minimum disparity. The value is
always greater than zero. In the current implementation, this parameter must
be divisible by 16.SADWindowSize
- Matched block size. It must be an odd number
>=1
. Normally, it should be somewhere in the 3..11
range.P1
- The first parameter controlling the disparity smoothness. See
below.P2
- The second parameter controlling the disparity smoothness. The
larger the values are, the smoother the disparity is. P1
is the
penalty on the disparity change by plus or minus 1 between neighbor pixels.
P2
is the penalty on the disparity change by more than 1 between
neighbor pixels. The algorithm requires P2 > P1
. See
stereo_match.cpp
sample where some reasonably good
P1
and P2
values are shown (like 8*number_of_image_channels*SADWindowSize*SADWindowSize
and 32*number_of_image_channels*SADWindowSize*SADWindowSize
,
respectively).disp12MaxDiff
- Maximum allowed difference (in integer pixel units) in
the left-right disparity check. Set it to a non-positive value to disable the
check.preFilterCap
- Truncation value for the prefiltered image pixels. The
algorithm first computes x-derivative at each pixel and clips its value by
[-preFilterCap, preFilterCap]
interval. The result values are
passed to the Birchfield-Tomasi pixel cost function.uniquenessRatio
- Margin in percentage by which the best (minimum)
computed cost function value should "win" the second best value to consider
the found match correct. Normally, a value within the 5-15 range is good
enough.speckleWindowSize
- Maximum size of smooth disparity regions to consider
their noise speckles and invalidate. Set it to 0 to disable speckle
filtering. Otherwise, set it somewhere in the 50-200 range.speckleRange
- Maximum disparity variation within each connected
component. If you do speckle filtering, set the parameter to a positive
value, multiple of 16. Normally, 16 or 32 is good enough.fullDP
- Set it to true
to run the full-scale two-pass
dynamic programming algorithm. It will consume O(W*H*numDisparities) bytes,
which is large for 640x480 stereo and huge for HD-size pictures. By default,
it is set to false
.protected StereoSGBM(long addr)
Method Detail |
---|
public void compute(Mat left, Mat right, Mat disp)
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public int get_disp12MaxDiff()
public boolean get_fullDP()
public int get_minDisparity()
public int get_numberOfDisparities()
public int get_P1()
public int get_P2()
public int get_preFilterCap()
public int get_SADWindowSize()
public int get_speckleRange()
public int get_speckleWindowSize()
public int get_uniquenessRatio()
public void set_disp12MaxDiff(int disp12MaxDiff)
public void set_fullDP(boolean fullDP)
public void set_minDisparity(int minDisparity)
public void set_numberOfDisparities(int numberOfDisparities)
public void set_P1(int P1)
public void set_P2(int P2)
public void set_preFilterCap(int preFilterCap)
public void set_SADWindowSize(int SADWindowSize)
public void set_speckleRange(int speckleRange)
public void set_speckleWindowSize(int speckleWindowSize)
public void set_uniquenessRatio(int uniquenessRatio)
|
Official OpenCV 2.4 Documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |