31 #include <opencv2/video/tracking.hpp>
37 bool opticalFlow = Parameters::defaultStereoOpticalFlow();
45 return new Stereo(parameters);
50 winWidth_(
Parameters::defaultStereoWinWidth()),
51 winHeight_(
Parameters::defaultStereoWinHeight()),
52 iterations_(
Parameters::defaultStereoIterations()),
53 maxLevel_(
Parameters::defaultStereoMaxLevel()),
54 minDisparity_(
Parameters::defaultStereoMinDisparity()),
55 maxDisparity_(
Parameters::defaultStereoMaxDisparity()),
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);