Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
objectRecognizer.hpp
00001 /* $Id$ */
00002 
00003 #ifndef _OBJECT_RECOGNIZER_HPP
00004 #define _OBJECT_RECOGNIZER_HPP
00005 
00006 #include "kernel/jafarException.hpp"
00007 #include "kernel/csvFile.hpp"
00008 #include "image/Image.hpp"
00009 #include "image/iterator.hpp"
00010 #include "jmath/jblas.hpp"
00011 #include "premodeler/ifManager.hpp"
00012 #include "premodeler/engine.hpp"
00013 #include "gfm/GroupsMatcher.hpp"
00014 #include "gfm/MatchingResult.hpp"
00015 #include "gfm/DetectionResult.hpp"
00016 #include "gfm/Detector.hpp"
00017 #include "gfm/HarrisDetector.hpp"
00018 #include "gfm/HarrisDescriptor.hpp"
00019 #include "gfm/DoubleDescriptor.hpp"
00020 #include "sift/SiftDetector.hpp"
00021 #include "surf/SurfDetector.hpp"
00022 #include "geom/Declarations.hpp"
00023 #include "geom/Point.hpp"
00024 
00025 namespace jafar {
00026   
00027   namespace oracle {
00028     const double ORACLE_RECOGNITION_THRESHOLD = 0.4;
00037     class ObjectRecognizer {
00038 
00039       /*
00040        * private attributes and methodes 
00041        */
00042       private:
00044       premodeler::SequenceMR smr;
00046       image::Image reqImg;
00048       std::string reqImgFileName;
00050       gfm::Detector *m_detector;
00052       gfm::GroupsMatcher* m_matcher;
00054       gfm::DetectionResult reqDetectResult;
00056       gfm::MatchSourceInfo* reqSourceInfo;
00058       struct ltMRst {
00059         bool operator()(const gfm::MatchingResult mr1, 
00060                         const gfm::MatchingResult mr2) const
00061         {
00062           return (mr1.matches().size() > mr2.matches().size());
00063         }
00064       };  
00066       std::map<gfm::MatchingResult, int, ltMRst> mrMap;
00067 
00068       public:
00070        ObjectRecognizer() { m_matcher = new gfm::GroupsMatcher(); };
00076       ObjectRecognizer(gfm::Detector* _detector,
00077                        gfm::GroupsMatcher* _matcher,
00078                        premodeler::SequenceMR _smr);
00080       ~ObjectRecognizer();
00082       void setRequestImage(const image::Image& _reqImg);
00084       void setRequestImage(const std::string& _reqImgFileName);
00086       void setDetector(gfm::Detector* _detector) {
00087         m_detector = _detector;
00088       }
00090       void setMatcher(gfm::GroupsMatcher* _matcher) {
00091         m_matcher = _matcher;
00092       }
00094       void setSequenceMatchingResult(const premodeler::SequenceMR& _smr){
00095         smr = _smr;
00096       }
00098       void process();
00100       std::map<int, jblas::vec2> detectedFeatures();
00102       std::map<int, geom::Point2D> detected2DPoints();
00104       inline image::Image requestImage() const {
00105         return reqImg;
00106       }
00108       inline std::string requestImageFileName() const {
00109         return reqImgFileName;
00110       }
00112       void setDetectionResult(const gfm::DetectionResult& _reqDetectionResult);
00114       inline gfm::DetectionResult detectionResult() const {
00115         return reqDetectResult;
00116       }
00118       int getBestView() const;
00120       gfm::vMatches getBestMatchesVector() const;
00122       double bestMatchingRatio() const;
00123       inline gfm::MatchingResult bestMatchingResult() const {
00124         return mrMap.begin()->first;
00125       }
00127       void mergeImages(const std::string& mergedImageName = "/home/nksallem/Desktop/merge.ppm");
00128 
00129       protected:
00130       int nextViewToProceed();
00131     };//class ObjectRecognizer
00132 
00133   }//namespace oracle
00134 
00135 }//namespace jafar
00136 
00137 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:25 for Jafar by doxygen 1.7.6.1
LAAS-CNRS