Go to the documentation of this file.00001 #ifndef _HOWARDMATCHER_H_
00002 #define _HOWARDMATCHER_H_
00003
00004 #include <opencv2/core/core.hpp>
00005 #include <opencv2/features2d/features2d.hpp>
00006 #include <frame_common/frame.h>
00007
00008 namespace pe
00009 {
00010 class HowardDescriptorExtractor : public cv::DescriptorExtractor
00011 {
00012 public:
00013 HowardDescriptorExtractor(int _neighborhoodSize = 7);
00014 virtual void read(const cv::FileNode &fn);
00015 virtual void write(cv::FileStorage &fs) const;
00016 virtual int descriptorSize() const;
00017 virtual int descriptorType() const;
00018
00019 protected:
00020 int neighborhoodSize;
00021 virtual void computeImpl(const cv::Mat& image, std::vector<cv::KeyPoint>& keypoints, cv::Mat& descriptors) const;
00022 };
00023
00024 class HowardStereoMatcher
00025 {
00026 public:
00027 HowardStereoMatcher(float thresh, int descriptorSize);
00028 void match(const frame_common::Frame& prevFrame, const frame_common::Frame& frame,
00029 std::vector<cv::DMatch>& matches, std::vector<int>& filteredIndices, const cv::Mat& mask);
00030 private:
00031 void filterKpts(const cv::Mat& img, const std::vector<cv::KeyPoint>& kpts, bool orientation);
00032 void calculateScoreMatrix(cv::Mat& scoreMatrix);
00033 void calculateCrossCheckMatches(const cv::Mat& scoreMatrix, std::vector<cv::DMatch>& matches);
00034 double calcDeltaL(const cv::Point3f& p11, const cv::Point3f& p21, double t, double f, double threshold);
00035
00036 void calculateConsistMatrix(const std::vector<cv::DMatch>& matches, const frame_common::Frame& prevFrame,
00037 const frame_common::Frame& frame, cv::Mat& consistMatrix);
00038 void filterMatches(const cv::Mat& consistMatrix, std::vector<int>& filteredIndices);
00039 private:
00040 float threshold;
00041 int descriptorSize;
00042 cv::Mat prevFrameDtors, frameDtors;
00043 cv::Ptr<cv::DescriptorExtractor> extractor;
00044 cv::Mat windowedMask;
00045 };
00046 }
00047
00048 #endif