OpenCV  5.0.0-pre
Open Source Computer Vision
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cv::stereo::QuasiDenseStereo Class Referenceabstract

Class containing the methods needed for Quasi Dense Stereo computation. More...

#include <opencv2/xstereo/quasi_dense_stereo.hpp>

Collaboration diagram for cv::stereo::QuasiDenseStereo:

Public Member Functions

virtual ~QuasiDenseStereo ()=0
 destructor Method to free all the memory allocated by matrices and vectors in this class.
 
virtual void getDenseMatches (std::vector< MatchQuasiDense > &denseMatches)=0
 Get The dense corresponding points.
 
virtual cv::Mat getDisparity ()=0
 Compute and return the disparity map based on the correspondences found in the "process" method.
 
virtual cv::Point2f getMatch (const int x, const int y)=0
 Specify pixel coordinates in the left image and get its corresponding location in the right image.
 
virtual void getSparseMatches (std::vector< MatchQuasiDense > &sMatches)=0
 Get The sparse corresponding points.
 
virtual int loadParameters (cv::String filepath)=0
 Load a file containing the configuration parameters of the class.
 
virtual void process (const cv::Mat &imgLeft, const cv::Mat &imgRight)=0
 Main process of the algorithm. This method computes the sparse seeds and then densifies them.
 
virtual int saveParameters (cv::String filepath)=0
 Save a file containing all the configuration parameters the class is currently set to.
 

Static Public Member Functions

static cv::Ptr< QuasiDenseStereocreate (cv::Size monoImgSize, cv::String paramFilepath=cv::String())
 

Public Attributes

PropagationParameters Param
 

Detailed Description

Class containing the methods needed for Quasi Dense Stereo computation.

This module contains the code to perform quasi dense stereo matching. The method initially starts with a sparse 3D reconstruction based on feature matching across a stereo image pair and subsequently propagates the structure into neighboring image regions. To obtain initial seed correspondences, the algorithm locates Shi and Tomashi features in the left image of the stereo pair and then tracks them using pyramidal Lucas-Kanade in the right image. To densify the sparse correspondences, the algorithm computes the zero-mean normalized cross-correlation (ZNCC) in small patches around every seed pair and uses it as a quality metric for each match. In this code, we introduce a custom structure to store the location and ZNCC value of correspondences called "Match". Seed Matches are stored in a priority queue sorted according to their ZNCC value, allowing for the best quality Match to be readily available. The algorithm pops Matches and uses them to extract new matches around them. This is done by considering a small neighboring area around each Seed and retrieving correspondences above a certain texture threshold that are not previously computed. New matches are stored in the seed priority queue and used as seeds. The propagation process ends when no additional matches can be retrieved.

See also
This code represents the work presented in [254]. If this code is useful for your work please cite [254].

Also the original growing scheme idea is described in [160]

Constructor & Destructor Documentation

◆ ~QuasiDenseStereo()

virtual cv::stereo::QuasiDenseStereo::~QuasiDenseStereo ( )
pure virtual

destructor Method to free all the memory allocated by matrices and vectors in this class.

Member Function Documentation

◆ create()

static cv::Ptr< QuasiDenseStereo > cv::stereo::QuasiDenseStereo::create ( cv::Size  monoImgSize,
cv::String  paramFilepath = cv::String() 
)
static
Python:
cv.stereo.QuasiDenseStereo.create(monoImgSize[, paramFilepath]) -> retval
cv.stereo.QuasiDenseStereo_create(monoImgSize[, paramFilepath]) -> retval

◆ getDenseMatches()

virtual void cv::stereo::QuasiDenseStereo::getDenseMatches ( std::vector< MatchQuasiDense > &  denseMatches)
pure virtual
Python:
cv.stereo.QuasiDenseStereo.getDenseMatches() -> denseMatches

Get The dense corresponding points.

Parameters
[out]denseMatchesA vector containing all dense matches.
Note
The method clears the denseMatches vector.
The returned Match elements inside the sMatches vector, do not use corr member.

◆ getDisparity()

virtual cv::Mat cv::stereo::QuasiDenseStereo::getDisparity ( )
pure virtual
Python:
cv.stereo.QuasiDenseStereo.getDisparity() -> retval

Compute and return the disparity map based on the correspondences found in the "process" method.

Note
Default level is 50
Returns
cv::Mat containing a the disparity image in grayscale.
See also
computeDisparity
quantizeDisparity

◆ getMatch()

virtual cv::Point2f cv::stereo::QuasiDenseStereo::getMatch ( const int  x,
const int  y 
)
pure virtual
Python:
cv.stereo.QuasiDenseStereo.getMatch(x, y) -> retval

Specify pixel coordinates in the left image and get its corresponding location in the right image.

Parameters
[in]xThe x pixel coordinate in the left image channel.
[in]yThe y pixel coordinate in the left image channel.
Return values
cv::Point(x,y)The location of the corresponding pixel in the right image.
cv::Point(0,0)(NO_MATCH) if no match is found in the right image for the specified pixel location in the left image.
Note
This method should be always called after process, otherwise the matches will not be correct.

◆ getSparseMatches()

virtual void cv::stereo::QuasiDenseStereo::getSparseMatches ( std::vector< MatchQuasiDense > &  sMatches)
pure virtual
Python:
cv.stereo.QuasiDenseStereo.getSparseMatches() -> sMatches

Get The sparse corresponding points.

Parameters
[out]sMatchesA vector containing all sparse correspondences.
Note
The method clears the sMatches vector.
The returned Match elements inside the sMatches vector, do not use corr member.

◆ loadParameters()

virtual int cv::stereo::QuasiDenseStereo::loadParameters ( cv::String  filepath)
pure virtual
Python:
cv.stereo.QuasiDenseStereo.loadParameters(filepath) -> retval

Load a file containing the configuration parameters of the class.

Parameters
[in]filepathThe location of the .YAML file containing the configuration parameters.
Note
default value is an empty string in which case the default parameters will be loaded.
Return values
1If the path is not empty and the program loaded the parameters successfully.
0If the path is empty and the program loaded default parameters.
-1If the file location is not valid or the program could not open the file and loaded default parameters from defaults.hpp.
Note
The method is automatically called in the constructor and configures the class.
Loading different parameters will have an effect on the output. This is useful for tuning in case of video processing.
See also
loadParameters

◆ process()

virtual void cv::stereo::QuasiDenseStereo::process ( const cv::Mat imgLeft,
const cv::Mat imgRight 
)
pure virtual
Python:
cv.stereo.QuasiDenseStereo.process(imgLeft, imgRight) -> None

Main process of the algorithm. This method computes the sparse seeds and then densifies them.

Initially input images are converted to gray-scale and then the sparseMatching method is called to obtain the sparse stereo. Finally quasiDenseMatching is called to densify the corresponding points.

Parameters
[in]imgLeftThe left Channel of a stereo image pair.
[in]imgRightThe right Channel of a stereo image pair.
Note
If input images are in color, the method assumes that are BGR and converts them to grayscale.
See also
sparseMatching
quasiDenseMatching

◆ saveParameters()

virtual int cv::stereo::QuasiDenseStereo::saveParameters ( cv::String  filepath)
pure virtual
Python:
cv.stereo.QuasiDenseStereo.saveParameters(filepath) -> retval

Save a file containing all the configuration parameters the class is currently set to.

Parameters
[in]filepathThe location to store the parameters file.
Note
Calling this method with no arguments will result in storing class parameters to a file names "qds_parameters.yaml" in the root project folder.
This method can be used to generate a template file for tuning the class.
See also
loadParameters

Member Data Documentation

◆ Param

PropagationParameters cv::stereo::QuasiDenseStereo::Param

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