30 #include <opencv2/calib3d/calib3d.hpp> 31 #include <opencv2/imgproc/imgproc.hpp> 32 #include <opencv2/imgproc/types_c.h> 37 blockSize_(blockSize),
38 minDisparity_(
Parameters::defaultStereoBMMinDisparity()),
39 numDisparities_(numDisparities),
40 preFilterSize_(
Parameters::defaultStereoBMPreFilterSize()),
41 preFilterCap_(
Parameters::defaultStereoBMPreFilterCap()),
42 uniquenessRatio_(
Parameters::defaultStereoBMUniquenessRatio()),
43 textureThreshold_(
Parameters::defaultStereoBMTextureThreshold()),
44 speckleWindowSize_(
Parameters::defaultStereoBMSpeckleWindowSize()),
45 speckleRange_(
Parameters::defaultStereoBMSpeckleRange()),
46 disp12MaxDiff_(
Parameters::defaultStereoBMDisp12MaxDiff())
80 const cv::Mat & leftImage,
81 const cv::Mat & rightImage)
const 83 UASSERT(!leftImage.empty() && !rightImage.empty());
84 UASSERT(leftImage.cols == rightImage.cols && leftImage.rows == rightImage.rows);
85 UASSERT((leftImage.type() == CV_8UC1 || leftImage.type() == CV_8UC3) && rightImage.type() == CV_8UC1);
88 if(leftImage.channels() == 3)
90 cv::cvtColor(leftImage, leftMono, CV_BGR2GRAY);
98 #if CV_MAJOR_VERSION < 3 99 cv::StereoBM stereo(cv::StereoBM::BASIC_PRESET);
109 stereo(leftMono, rightImage, disparity, CV_16SC1);
111 cv::Ptr<cv::StereoBM> stereo = cv::StereoBM::create();
122 stereo->compute(leftMono, rightImage, disparity);
StereoBM(int blockSize, int numDisparities)
virtual void parseParameters(const ParametersMap ¶meters)
static bool parse(const ParametersMap ¶meters, const std::string &key, bool &value)
std::map< std::string, std::string > ParametersMap
#define UASSERT(condition)
virtual cv::Mat computeDisparity(const cv::Mat &leftImage, const cv::Mat &rightImage) const
ULogger class and convenient macros.