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())
77 const cv::Mat & leftImage,
78 const cv::Mat & rightImage)
const 80 UASSERT(!leftImage.empty() && !rightImage.empty());
81 UASSERT(leftImage.cols == rightImage.cols && leftImage.rows == rightImage.rows);
82 UASSERT((leftImage.type() == CV_8UC1 || leftImage.type() == CV_8UC3) && rightImage.type() == CV_8UC1);
85 if(leftImage.channels() == 3)
87 cv::cvtColor(leftImage, leftMono, CV_BGR2GRAY);
95 #if CV_MAJOR_VERSION < 3 96 cv::StereoBM stereo(cv::StereoBM::BASIC_PRESET);
106 stereo(leftMono, rightImage, disparity, CV_16SC1);
108 cv::Ptr<cv::StereoBM> stereo = cv::StereoBM::create();
118 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.