31 #include <opencv2/video/tracking.hpp> 37 bool opticalFlow = Parameters::defaultStereoOpticalFlow();
45 return new Stereo(parameters);
73 const cv::Mat & leftImage,
74 const cv::Mat & rightImage,
75 const std::vector<cv::Point2f> & leftCorners,
76 std::vector<unsigned char> & status)
const 78 std::vector<cv::Point2f> rightCorners;
79 UDEBUG(
"util2d::calcStereoCorrespondences() begin");
91 UDEBUG(
"util2d::calcStereoCorrespondences() end");
110 const cv::Mat & leftImage,
111 const cv::Mat & rightImage,
112 const std::vector<cv::Point2f> & leftCorners,
113 std::vector<unsigned char> & status)
const 115 std::vector<cv::Point2f> rightCorners;
116 UDEBUG(
"util2d::calcOpticalFlowPyrLKStereo() begin");
117 std::vector<float> err;
127 cv::TermCriteria(cv::TermCriteria::COUNT+cv::TermCriteria::EPS, this->
iterations(),
epsilon_),
128 cv::OPTFLOW_LK_GET_MIN_EIGENVALS, 1
e-4);
129 UDEBUG(
"util2d::calcOpticalFlowPyrLKStereo() end");
130 UASSERT(leftCorners.size() == rightCorners.size() && status.size() == leftCorners.size());
131 int countFlowRejected = 0;
132 int countDisparityRejected = 0;
133 for(
unsigned int i=0; i<status.size(); ++i)
137 float disparity = leftCorners[i].x - rightCorners[i].x;
141 ++countDisparityRejected;
149 UDEBUG(
"total=%d countFlowRejected=%d countDisparityRejected=%d", (
int)status.size(), countFlowRejected, countDisparityRejected);
static bool parse(const ParametersMap ¶meters, const std::string &key, bool &value)
float maxDisparity() const
virtual std::vector< cv::Point2f > computeCorrespondences(const cv::Mat &leftImage, const cv::Mat &rightImage, const std::vector< cv::Point2f > &leftCorners, std::vector< unsigned char > &status) const
Stereo(const ParametersMap ¶meters=ParametersMap())
GLM_FUNC_DECL genType e()
std::map< std::string, std::string > ParametersMap
virtual std::vector< cv::Point2f > computeCorrespondences(const cv::Mat &leftImage, const cv::Mat &rightImage, const std::vector< cv::Point2f > &leftCorners, std::vector< unsigned char > &status) const
#define UASSERT(condition)
virtual void parseParameters(const ParametersMap ¶meters)
static Stereo * create(const ParametersMap ¶meters=ParametersMap())
ULogger class and convenient macros.
StereoOpticalFlow(const ParametersMap ¶meters=ParametersMap())
std::vector< cv::Point2f > RTABMAP_EXP calcStereoCorrespondences(const cv::Mat &leftImage, const cv::Mat &rightImage, const std::vector< cv::Point2f > &leftCorners, std::vector< unsigned char > &status, cv::Size winSize=cv::Size(6, 3), int maxLevel=3, int iterations=5, float minDisparity=0.0f, float maxDisparity=64.0f, bool ssdApproach=true)
virtual void parseParameters(const ParametersMap ¶meters)
float minDisparity() const
void RTABMAP_EXP calcOpticalFlowPyrLKStereo(cv::InputArray _prevImg, cv::InputArray _nextImg, cv::InputArray _prevPts, cv::InputOutputArray _nextPts, cv::OutputArray _status, cv::OutputArray _err, cv::Size winSize=cv::Size(15, 3), int maxLevel=3, cv::TermCriteria criteria=cv::TermCriteria(cv::TermCriteria::COUNT+cv::TermCriteria::EPS, 30, 0.01), int flags=0, double minEigThreshold=1e-4)