OpenCV 2.4.3.2

org.opencv.calib3d
Class StereoBM

java.lang.Object
  extended by org.opencv.calib3d.StereoBM

public class StereoBM
extends java.lang.Object

Class for computing stereo correspondence using the block matching algorithm.

// Block matching stereo correspondence algorithm class StereoBM

// C++ code:

enum { NORMALIZED_RESPONSE = CV_STEREO_BM_NORMALIZED_RESPONSE,

BASIC_PRESET=CV_STEREO_BM_BASIC,

FISH_EYE_PRESET=CV_STEREO_BM_FISH_EYE,

NARROW_PRESET=CV_STEREO_BM_NARROW };

StereoBM();

// the preset is one of..._PRESET above.

// ndisparities is the size of disparity range,

// in which the optimal disparity at each pixel is searched for.

// SADWindowSize is the size of averaging window used to match pixel blocks

// (larger values mean better robustness to noise, but yield blurry disparity maps)

StereoBM(int preset, int ndisparities=0, int SADWindowSize=21);

// separate initialization function

void init(int preset, int ndisparities=0, int SADWindowSize=21);

// computes the disparity for the two rectified 8-bit single-channel images.

// the disparity will be 16-bit signed (fixed-point) or 32-bit floating-point image of the same size as left.

void operator()(InputArray left, InputArray right, OutputArray disparity, int disptype=CV_16S);

Ptr state;

};

The class is a C++ wrapper for the associated functions. In particular, :ocv:funcx:"StereoBM.operator()" is the wrapper for

"cvFindStereoCorrespondenceBM".

See Also:
org.opencv.calib3d.StereoBM

Field Summary
static int BASIC_PRESET
           
static int FISH_EYE_PRESET
           
static int NARROW_PRESET
           
static int PREFILTER_NORMALIZED_RESPONSE
           
static int PREFILTER_XSOBEL
           
 
Constructor Summary
StereoBM()
          The constructors.
StereoBM(int preset)
          The constructors.
StereoBM(int preset, int ndisparities, int SADWindowSize)
          The constructors.
 
Method Summary
 void compute(Mat left, Mat right, Mat disparity)
          Computes disparity using the BM algorithm for a rectified stereo pair.
 void compute(Mat left, Mat right, Mat disparity, int disptype)
          Computes disparity using the BM algorithm for a rectified stereo pair.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASIC_PRESET

public static final int BASIC_PRESET
See Also:
Constant Field Values

FISH_EYE_PRESET

public static final int FISH_EYE_PRESET
See Also:
Constant Field Values

NARROW_PRESET

public static final int NARROW_PRESET
See Also:
Constant Field Values

PREFILTER_NORMALIZED_RESPONSE

public static final int PREFILTER_NORMALIZED_RESPONSE
See Also:
Constant Field Values

PREFILTER_XSOBEL

public static final int PREFILTER_XSOBEL
See Also:
Constant Field Values
Constructor Detail

StereoBM

public StereoBM()

The constructors.

The constructors initialize StereoBM state. You can then call StereoBM.operator() to compute disparity for a specific stereo pair.

Note: In the C API you need to deallocate CvStereoBM state when it is not needed anymore using cvReleaseStereoBMState(&stereobm).

See Also:
org.opencv.calib3d.StereoBM.StereoBM

StereoBM

public StereoBM(int preset)

The constructors.

The constructors initialize StereoBM state. You can then call StereoBM.operator() to compute disparity for a specific stereo pair.

Note: In the C API you need to deallocate CvStereoBM state when it is not needed anymore using cvReleaseStereoBMState(&stereobm).

Parameters:
preset - specifies the whole set of algorithm parameters, one of:
  • BASIC_PRESET - parameters suitable for general cameras
  • FISH_EYE_PRESET - parameters suitable for wide-angle cameras
  • NARROW_PRESET - parameters suitable for narrow-angle cameras

After constructing the class, you can override any parameters set by the preset.

See Also:
org.opencv.calib3d.StereoBM.StereoBM

StereoBM

public StereoBM(int preset,
                int ndisparities,
                int SADWindowSize)

The constructors.

The constructors initialize StereoBM state. You can then call StereoBM.operator() to compute disparity for a specific stereo pair.

Note: In the C API you need to deallocate CvStereoBM state when it is not needed anymore using cvReleaseStereoBMState(&stereobm).

Parameters:
preset - specifies the whole set of algorithm parameters, one of:
  • BASIC_PRESET - parameters suitable for general cameras
  • FISH_EYE_PRESET - parameters suitable for wide-angle cameras
  • NARROW_PRESET - parameters suitable for narrow-angle cameras

After constructing the class, you can override any parameters set by the preset.

ndisparities - the disparity search range. For each pixel algorithm will find the best disparity from 0 (default minimum disparity) to ndisparities. The search range can then be shifted by changing the minimum disparity.
SADWindowSize - 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.
See Also:
org.opencv.calib3d.StereoBM.StereoBM
Method Detail

compute

public void compute(Mat left,
                    Mat right,
                    Mat disparity)

Computes disparity using the BM algorithm for a rectified stereo pair.

The method executes the BM algorithm on a rectified stereo pair. See the stereo_match.cpp OpenCV sample on how to prepare images and call the method. Note that the method is not constant, thus you should not use the same StereoBM instance from within different threads simultaneously. The function is parallelized with the TBB library.

Parameters:
left - Left 8-bit single-channel image.
right - Right image of the same size and the same type as the left one.
disparity - Output disparity map. It has the same size as the input images. When disptype==CV_16S, the map is a 16-bit signed single-channel image, containing disparity values scaled by 16. To get the true disparity values from such fixed-point representation, you will need to divide each disp element by 16. If disptype==CV_32F, the disparity map will already contain the real disparity values on output.
See Also:
org.opencv.calib3d.StereoBM.operator()

compute

public void compute(Mat left,
                    Mat right,
                    Mat disparity,
                    int disptype)

Computes disparity using the BM algorithm for a rectified stereo pair.

The method executes the BM algorithm on a rectified stereo pair. See the stereo_match.cpp OpenCV sample on how to prepare images and call the method. Note that the method is not constant, thus you should not use the same StereoBM instance from within different threads simultaneously. The function is parallelized with the TBB library.

Parameters:
left - Left 8-bit single-channel image.
right - Right image of the same size and the same type as the left one.
disparity - Output disparity map. It has the same size as the input images. When disptype==CV_16S, the map is a 16-bit signed single-channel image, containing disparity values scaled by 16. To get the true disparity values from such fixed-point representation, you will need to divide each disp element by 16. If disptype==CV_32F, the disparity map will already contain the real disparity values on output.
disptype - Type of the output disparity map, CV_16S (default) or CV_32F.
See Also:
org.opencv.calib3d.StereoBM.operator()

OpenCV 2.4.3.2 Documentation