OpenCV for Unity 3.0.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.12.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.Calib3dModule.StereoBM Class Reference

Class for computing stereo correspondence using the block matching algorithm, introduced and contributed to OpenCV by K. Konolige. More...

Public Member Functions

int getPreFilterCap ()
 Gets the current truncation value for prefiltered pixels.
 
int getPreFilterSize ()
 Gets the current size of the pre-filter kernel.
 
int getPreFilterType ()
 Gets the type of pre-filtering currently used in the algorithm.
 
Rect getROI1 ()
 Gets the current Region of Interest (ROI) for the left image.
 
int int int int height getROI1AsValueTuple ()
 
Vec4i getROI1AsVec4i ()
 Gets the current Region of Interest (ROI) for the left image.
 
Rect getROI2 ()
 Gets the current Region of Interest (ROI) for the right image.
 
int int int int height getROI2AsValueTuple ()
 
Vec4i getROI2AsVec4i ()
 Gets the current Region of Interest (ROI) for the right image.
 
int getSmallerBlockSize ()
 Gets the current size of the smaller block used for texture check.
 
int getTextureThreshold ()
 Gets the current texture threshold value.
 
int getUniquenessRatio ()
 Gets the current uniqueness ratio value.
 
void setPreFilterCap (int preFilterCap)
 Sets the truncation value for prefiltered pixels.
 
void setPreFilterSize (int preFilterSize)
 Sets the size of the pre-filter kernel.
 
void setPreFilterType (int preFilterType)
 Sets the type of pre-filtering used in the algorithm.
 
void setROI1 (in Vec4i roi1)
 Sets the Region of Interest (ROI) for the left image.
 
void setROI1 (in(int x, int y, int width, int height) roi1)
 Sets the Region of Interest (ROI) for the left image.
 
void setROI1 (Rect roi1)
 Sets the Region of Interest (ROI) for the left image.
 
void setROI2 (in Vec4i roi2)
 Sets the Region of Interest (ROI) for the right image.
 
void setROI2 (in(int x, int y, int width, int height) roi2)
 Sets the Region of Interest (ROI) for the right image.
 
void setROI2 (Rect roi2)
 Sets the Region of Interest (ROI) for the right image.
 
void setSmallerBlockSize (int blockSize)
 Sets the size of the smaller block used for texture check.
 
void setTextureThreshold (int textureThreshold)
 Sets the threshold for filtering low-texture regions.
 
void setUniquenessRatio (int uniquenessRatio)
 Sets the uniqueness ratio for filtering ambiguous matches.
 
- Public Member Functions inherited from OpenCVForUnity.Calib3dModule.StereoMatcher
void compute (Mat left, Mat right, Mat disparity)
 Computes disparity map for the specified stereo pair.
 
int getBlockSize ()
 
int getDisp12MaxDiff ()
 
int getMinDisparity ()
 
int getNumDisparities ()
 
int getSpeckleRange ()
 
int getSpeckleWindowSize ()
 
void setBlockSize (int blockSize)
 
void setDisp12MaxDiff (int disp12MaxDiff)
 
void setMinDisparity (int minDisparity)
 
void setNumDisparities (int numDisparities)
 
void setSpeckleRange (int speckleRange)
 
void setSpeckleWindowSize (int speckleWindowSize)
 
- Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
virtual void clear ()
 Clears the algorithm state.
 
virtual bool empty ()
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
virtual string getDefaultName ()
 
IntPtr getNativeObjAddr ()
 
void save (string filename)
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new StereoBM __fromPtr__ (IntPtr addr)
 
static StereoBM create ()
 Creates StereoBM object.
 
static StereoBM create (int numDisparities)
 Creates StereoBM object.
 
static StereoBM create (int numDisparities, int blockSize)
 Creates StereoBM object.
 
- Static Public Member Functions inherited from OpenCVForUnity.Calib3dModule.StereoMatcher
static new StereoMatcher __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
static Algorithm __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Public Attributes

int int int width
 
int x
 Gets the current Region of Interest (ROI) for the left image.
 
int int y
 

Static Public Attributes

const int PREFILTER_NORMALIZED_RESPONSE = 0
 C++: enum <unnamed>
 
const int PREFILTER_XSOBEL = 1
 C++: enum <unnamed>
 
- Static Public Attributes inherited from OpenCVForUnity.Calib3dModule.StereoMatcher
const int DISP_SCALE = (1 << DISP_SHIFT)
 C++: enum <unnamed>
 
const int DISP_SHIFT = 4
 C++: enum <unnamed>
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.Calib3dModule.StereoMatcher
override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Package Functions inherited from OpenCVForUnity.Calib3dModule.StereoMatcher
- Package Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject
- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

Class for computing stereo correspondence using the block matching algorithm, introduced and contributed to OpenCV by K. Konolige.

This class implements a block matching algorithm for stereo correspondence, which is used to compute disparity maps from stereo image pairs. It provides methods to fine-tune parameters such as pre-filtering, texture thresholds, uniqueness ratios, and regions of interest (ROIs) to optimize performance and accuracy.

Member Function Documentation

◆ __fromPtr__()

static new StereoBM OpenCVForUnity.Calib3dModule.StereoBM.__fromPtr__ ( IntPtr addr)
static

◆ create() [1/3]

static StereoBM OpenCVForUnity.Calib3dModule.StereoBM.create ( )
static

Creates StereoBM object.

Parameters
numDisparitiesThe disparity search range. For each pixel, the algorithm will find the best disparity from 0 (default minimum disparity) to numDisparities. The search range can be shifted by changing the minimum disparity.
blockSizeThe 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 a higher chance for the algorithm to find a wrong correspondence.
Returns

A pointer to the created StereoBM object.

The function creates a StereoBM object. You can then call StereoBM.compute() to compute disparity for a specific stereo pair.

◆ create() [2/3]

static StereoBM OpenCVForUnity.Calib3dModule.StereoBM.create ( int numDisparities)
static

Creates StereoBM object.

Parameters
numDisparitiesThe disparity search range. For each pixel, the algorithm will find the best disparity from 0 (default minimum disparity) to numDisparities. The search range can be shifted by changing the minimum disparity.
blockSizeThe 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 a higher chance for the algorithm to find a wrong correspondence.
Returns

A pointer to the created StereoBM object.

The function creates a StereoBM object. You can then call StereoBM.compute() to compute disparity for a specific stereo pair.

◆ create() [3/3]

static StereoBM OpenCVForUnity.Calib3dModule.StereoBM.create ( int numDisparities,
int blockSize )
static

Creates StereoBM object.

Parameters
numDisparitiesThe disparity search range. For each pixel, the algorithm will find the best disparity from 0 (default minimum disparity) to numDisparities. The search range can be shifted by changing the minimum disparity.
blockSizeThe 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 a higher chance for the algorithm to find a wrong correspondence.
Returns

A pointer to the created StereoBM object.

The function creates a StereoBM object. You can then call StereoBM.compute() to compute disparity for a specific stereo pair.

◆ Dispose()

override void OpenCVForUnity.Calib3dModule.StereoBM.Dispose ( bool disposing)
protectedvirtual

◆ getPreFilterCap()

int OpenCVForUnity.Calib3dModule.StereoBM.getPreFilterCap ( )

Gets the current truncation value for prefiltered pixels.

Returns
The current pre-filter cap value.

◆ getPreFilterSize()

int OpenCVForUnity.Calib3dModule.StereoBM.getPreFilterSize ( )

Gets the current size of the pre-filter kernel.

Returns
The current pre-filter size.

◆ getPreFilterType()

int OpenCVForUnity.Calib3dModule.StereoBM.getPreFilterType ( )

Gets the type of pre-filtering currently used in the algorithm.

Returns
The current pre-filter type: 0 for PREFILTER_NORMALIZED_RESPONSE or 1 for PREFILTER_XSOBEL.

◆ getROI1()

Rect OpenCVForUnity.Calib3dModule.StereoBM.getROI1 ( )

Gets the current Region of Interest (ROI) for the left image.

Returns
The current ROI for the left image.

◆ getROI1AsValueTuple()

int int int int height OpenCVForUnity.Calib3dModule.StereoBM.getROI1AsValueTuple ( )

◆ getROI1AsVec4i()

Vec4i OpenCVForUnity.Calib3dModule.StereoBM.getROI1AsVec4i ( )

Gets the current Region of Interest (ROI) for the left image.

Returns
The current ROI for the left image.

◆ getROI2()

Rect OpenCVForUnity.Calib3dModule.StereoBM.getROI2 ( )

Gets the current Region of Interest (ROI) for the right image.

Returns
The current ROI for the right image.

◆ getROI2AsValueTuple()

int int int int height OpenCVForUnity.Calib3dModule.StereoBM.getROI2AsValueTuple ( )

◆ getROI2AsVec4i()

Vec4i OpenCVForUnity.Calib3dModule.StereoBM.getROI2AsVec4i ( )

Gets the current Region of Interest (ROI) for the right image.

Returns
The current ROI for the right image.

◆ getSmallerBlockSize()

int OpenCVForUnity.Calib3dModule.StereoBM.getSmallerBlockSize ( )

Gets the current size of the smaller block used for texture check.

Returns
The current smaller block size.

◆ getTextureThreshold()

int OpenCVForUnity.Calib3dModule.StereoBM.getTextureThreshold ( )

Gets the current texture threshold value.

Returns
The current texture threshold.

◆ getUniquenessRatio()

int OpenCVForUnity.Calib3dModule.StereoBM.getUniquenessRatio ( )

Gets the current uniqueness ratio value.

Returns
The current uniqueness ratio.

◆ setPreFilterCap()

void OpenCVForUnity.Calib3dModule.StereoBM.setPreFilterCap ( int preFilterCap)

Sets the truncation value for prefiltered pixels.

Parameters
preFilterCapThe truncation value. Typically in the range [1, 63].

This value caps the output of the pre-filter to [-preFilterCap, preFilterCap], helping to reduce the impact of noise and outliers in the pre-filtered image.

◆ setPreFilterSize()

void OpenCVForUnity.Calib3dModule.StereoBM.setPreFilterSize ( int preFilterSize)

Sets the size of the pre-filter kernel.

Parameters
preFilterSizeThe size of the pre-filter kernel. Must be an odd integer, typically between 5 and 255.

The pre-filter size determines the spatial extent of the pre-filtering operation, which prepares the images for disparity computation by normalizing brightness and enhancing texture. Larger sizes reduce noise but may blur details, while smaller sizes preserve details but are more susceptible to noise.

◆ setPreFilterType()

void OpenCVForUnity.Calib3dModule.StereoBM.setPreFilterType ( int preFilterType)

Sets the type of pre-filtering used in the algorithm.

Parameters
preFilterTypeThe type of pre-filter to use. Possible values are:
  • PREFILTER_NORMALIZED_RESPONSE (0): Uses normalized response for pre-filtering.
  • PREFILTER_XSOBEL (1): Uses the X-Sobel operator for pre-filtering.

The pre-filter type affects how the images are prepared before computing the disparity map. Different pre-filtering methods can enhance specific image features or reduce noise, influencing the quality of the disparity map.

◆ setROI1() [1/3]

void OpenCVForUnity.Calib3dModule.StereoBM.setROI1 ( in Vec4i roi1)

Sets the Region of Interest (ROI) for the left image.

Parameters
roi1The ROI rectangle for the left image.

By setting the ROI, the stereo matching computation is limited to the specified region, improving performance and potentially accuracy by focusing on relevant parts of the image.

◆ setROI1() [2/3]

void OpenCVForUnity.Calib3dModule.StereoBM.setROI1 ( in(int x, int y, int width, int height) roi1)

Sets the Region of Interest (ROI) for the left image.

Parameters
roi1The ROI rectangle for the left image.

By setting the ROI, the stereo matching computation is limited to the specified region, improving performance and potentially accuracy by focusing on relevant parts of the image.

◆ setROI1() [3/3]

void OpenCVForUnity.Calib3dModule.StereoBM.setROI1 ( Rect roi1)

Sets the Region of Interest (ROI) for the left image.

Parameters
roi1The ROI rectangle for the left image.

By setting the ROI, the stereo matching computation is limited to the specified region, improving performance and potentially accuracy by focusing on relevant parts of the image.

◆ setROI2() [1/3]

void OpenCVForUnity.Calib3dModule.StereoBM.setROI2 ( in Vec4i roi2)

Sets the Region of Interest (ROI) for the right image.

Parameters
roi2The ROI rectangle for the right image.

Similar to setROI1, this limits the computation to the specified region in the right image.

◆ setROI2() [2/3]

void OpenCVForUnity.Calib3dModule.StereoBM.setROI2 ( in(int x, int y, int width, int height) roi2)

Sets the Region of Interest (ROI) for the right image.

Parameters
roi2The ROI rectangle for the right image.

Similar to setROI1, this limits the computation to the specified region in the right image.

◆ setROI2() [3/3]

void OpenCVForUnity.Calib3dModule.StereoBM.setROI2 ( Rect roi2)

Sets the Region of Interest (ROI) for the right image.

Parameters
roi2The ROI rectangle for the right image.

Similar to setROI1, this limits the computation to the specified region in the right image.

◆ setSmallerBlockSize()

void OpenCVForUnity.Calib3dModule.StereoBM.setSmallerBlockSize ( int blockSize)

Sets the size of the smaller block used for texture check.

Parameters
blockSizeThe size of the smaller block. Must be an odd integer between 5 and 255.

This parameter determines the size of the block used to compute texture variance. Smaller blocks capture finer details but are more sensitive to noise, while larger blocks are more robust but may miss fine details.

◆ setTextureThreshold()

void OpenCVForUnity.Calib3dModule.StereoBM.setTextureThreshold ( int textureThreshold)

Sets the threshold for filtering low-texture regions.

Parameters
textureThresholdThe threshold value. Must be non-negative.

This parameter filters out regions with low texture, where establishing correspondences is difficult, thus reducing noise in the disparity map. Higher values filter more aggressively but may discard valid information.

◆ setUniquenessRatio()

void OpenCVForUnity.Calib3dModule.StereoBM.setUniquenessRatio ( int uniquenessRatio)

Sets the uniqueness ratio for filtering ambiguous matches.

Parameters
uniquenessRatioThe uniqueness ratio value. Typically in the range [5, 15], but can be from 0 to 100.

This parameter ensures that the best match is sufficiently better than the next best match, reducing false positives. Higher values are stricter but may filter out valid matches in difficult regions.

Member Data Documentation

◆ PREFILTER_NORMALIZED_RESPONSE

const int OpenCVForUnity.Calib3dModule.StereoBM.PREFILTER_NORMALIZED_RESPONSE = 0
static

C++: enum <unnamed>

◆ PREFILTER_XSOBEL

const int OpenCVForUnity.Calib3dModule.StereoBM.PREFILTER_XSOBEL = 1
static

C++: enum <unnamed>

◆ width

int int int OpenCVForUnity.Calib3dModule.StereoBM.width

◆ x

int OpenCVForUnity.Calib3dModule.StereoBM.x

Gets the current Region of Interest (ROI) for the left image.

Gets the current Region of Interest (ROI) for the right image.

Returns
The current ROI for the left image.
Returns
The current ROI for the right image.

◆ y

int int OpenCVForUnity.Calib3dModule.StereoBM.y

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