/* * Copyright (c) 2013 New Designs Unlimited, LLC * Opensource Automated License Plate Recognition [http://www.openalpr.com] * * This file is part of OpenAlpr. * * OpenAlpr is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License * version 3 as published by the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ #ifndef OPENALPR_FEATUREMATCHER_H #define OPENALPR_FEATUREMATCHER_H #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/video/tracking.hpp" #include "support/filesystem.h" #include "constants.h" #include "utility.h" #include "config.h" using namespace cv; using namespace std; struct RecognitionResult { bool haswinner; string winner; int confidence; } ; class FeatureMatcher { public: FeatureMatcher(Config* config); virtual ~FeatureMatcher(); RecognitionResult recognize( const Mat& queryImg, bool drawOnImage, Mat* outputImage, bool debug_on, vector debug_matches_array ); bool loadRecognitionSet(string country); bool isLoaded(); int numTrainingElements(); private: Config* config; Ptr descriptorMatcher; Ptr detector; Ptr extractor; vector > trainingImgKeypoints; void _surfStyleMatching(const Mat& queryDescriptors, vector > matchesKnn, vector& matches12); void crisscrossFiltering(const vector queryKeypoints, const vector inputMatches, vector &outputMatches); vector billMapping; void surfStyleMatching( const Mat& queryDescriptors, vector queryKeypoints, vector& matches12 ); }; #endif // OPENALPR_FEATUREMATCHER_H