Go to the documentation of this file.00001
00005 #ifndef _THERMALVIS_KEYFRAMES_H_
00006 #define _THERMALVIS_KEYFRAMES_H_
00007
00008 #include "general_resources.hpp"
00009 #include "opencv_resources.hpp"
00010
00011 #include "features.hpp"
00012
00013 #define KF_CONNECTION_WEAK 0
00014 #define KF_CONNECTION_GEOMETRIC 1
00015 #define KF_CONNECTION_HOMOGRAPHIC 2
00016
00017 #define KF_TYPE_FIRST 0
00018 #define KF_TYPE_LAST 1
00019 #define KF_TYPE_GEOMETRIC 2
00020 #define KF_TYPE_HOMOGRAPHIC 3
00021 #define KF_TYPE_EXHAUSTED 4
00022 #define KF_TYPE_WEAK 5
00023
00024 #define MAXIMUM_FEATURES_PER_FRAME 200
00025
00026 #define MATCHING_SIZE_CONSTRAINT 0.2
00027 #define MATCHING_DIST_CONSTRAINT 100
00028
00030 struct keyframe {
00031
00032 unsigned int idx;
00033 cv::Mat im;
00034 vector<cv::KeyPoint> keypoints;
00035 cv::Mat descriptors;
00036
00037 bool poseDetermined;
00038
00040 void detectKeypoints(cv::Ptr<cv::FeatureDetector>& detector);
00041
00043 void extractDescriptors(cv::Ptr<cv::DescriptorExtractor>& extractor);
00044
00045 };
00046
00048 struct connection {
00049
00050 unsigned int idx1, idx2;
00051 cv::Mat matchingMatrix;
00052 int type;
00053 double confidence;
00054 cv::Mat relation;
00055 bool processed;
00056 vector<vector<cv::DMatch> > matches1to2;
00057
00058 };
00059
00061 struct keyframeStore {
00062
00063 vector<keyframe> keyframes;
00064 vector<connection> connections;
00065 unsigned int count;
00066
00067
00068
00069 keyframeStore();
00070
00072 bool getBestPair(int& idx1, int& idx2);
00073
00075 void addKeyframe(int idx, cv::Mat& image);
00076
00078 void addConnection(int idx1, int idx2, int type = KF_CONNECTION_WEAK, cv::Mat rel = cv::Mat());
00079
00081 void findStrongConnections(int idx, vector<unsigned int>& cIndices);
00082
00084 void findMatches();
00085
00086 };
00087
00088 bool getValidLocalMaxima(cv::Mat& scores, unsigned int last_iii, unsigned int last_jjj, unsigned int& opt_iii, unsigned int& opt_jjj);
00089
00090 #endif