Go to the documentation of this file.00001
00002
00003 #ifndef _RECOGNIZER_THREAD_H_
00004 #define _RECOGNIZER_THREAD_H_
00005
00006 #include <blort/ThreadObject/Thread.h>
00007 #include <blort/Recognizer3D/Recognizer3D.h>
00008 #include <vector>
00009 #include <opencv2/core/core.hpp>
00010
00011 class CRecognizerThread : public CThread
00012 {
00013 private:
00014 enum Command{
00015 RECOGNIZE,
00016 LEARN,
00017 LOAD,
00018 SAVE,
00019 GETSIFT,
00020 GETLASTSIFT,
00021 IDLE,
00022 };
00023 Command cmd;
00024
00025 CEventClass m_evCmd, m_evData;
00026 CMutexClass m_running;
00027
00028 bool m_quit;
00029 std::map<std::string, double> m_confs;
00030 std::string m_sift_file;
00031 blortRecognizer::CameraParameter m_params;
00032 std::map<std::string, boost::shared_ptr<TomGine::tgPose> > m_poses;
00033 std::vector< boost::shared_ptr<TomGine::tgModel> > m_models;
00034 IplImage* m_image;
00035 std::vector<blortRecognizer::Siftex> m_lastsiftexlist;
00036 std::vector<blortRecognizer::Siftex> m_siftexlist;
00037
00038 cv::Mat result;
00039 std::string config_root;
00040
00041 public:
00042 CRecognizerThread(const blortRecognizer::CameraParameter& params, std::string config_root="");
00043 ~CRecognizerThread();
00044
00045 void Recognize(IplImage* image, std::map<std::string, boost::shared_ptr<TomGine::tgPose> > & poses, std::map<std::string, double> & confs);
00046
00047 void LearnSifts(IplImage* image, TomGine::tgModel &model, TomGine::tgPose& pose);
00048
00049 void LoadSiftModel(const std::string& sift_file);
00050
00051 void SaveSiftModel(const std::string& sift_file);
00052
00053 void GetSifts(std::vector<blortRecognizer::Siftex>& sl);
00054
00055 void GetLastSifts(std::vector<blortRecognizer::Siftex>& sl);
00056
00057 virtual BOOL OnTask();
00058
00059 cv::Mat getImage(){ return result; }
00060 };
00061
00062 #endif
00063