Go to the documentation of this file.00001
00033 #ifndef __OBJECT_MODEL__
00034 #define __OBJECT_MODEL__
00035
00036 #include "VisualizationModel.h"
00037 #include "DVision.h"
00038
00039 #include <string>
00040 #include <vector>
00041 #include <opencv/cv.h>
00042
00043 typedef DVision::PMVS::PLYFile PLYFile;
00044 typedef DVision::SurfSet SurfSet;
00045
00046
00047
00048
00049
00050
00051 #define OPENCV_ADV_MATCHER 1 //diamondback
00052
00053 class ObjectModel
00054 {
00062 private:
00063
00064 ObjectModel (const ObjectModel &);
00065 ObjectModel & operator = (const ObjectModel &);
00066
00067 public:
00068
00069 ObjectModel();
00070
00077 ObjectModel(const std::string &dir, bool load_visualization_model);
00078
00079 virtual ~ObjectModel();
00080
00090 void loadDirectory(const std::string &dir, bool load_visualization_model);
00091
00097 static std::string getName(const std::string &dir);
00098
00104 static bool checkDirectory(const std::string &dir);
00105
00125 void detectFaces(const SurfSet &scene, std::vector<int>& face_indices,
00126 std::vector<std::vector<int> >& key_indices,
00127 std::vector<std::vector<int> >& scene_indices,
00128 std::vector<std::vector<float> >& distances,
00129 int min_detected_points = 1, int max_correspondences_per_point = 3,
00130 float max_ratio = 0.6);
00131
00135 inline const VisualizationModel &getVisualizationModel() const
00136 {
00137 return *m_visualization_model;
00138 }
00139
00140 public:
00141
00142 struct Face
00143 {
00144 SurfSet surf;
00145 std::vector<PLYFile::PLYPoint> plypoints;
00146 cv::Mat image;
00147 cv::Mat A;
00148 cv::Mat cRo, cto;
00149
00150
00151 #if OPENCV_ADV_MATCHER
00152
00153 cv::FlannBasedMatcher flann_matcher;
00154 #else
00155 cv::flann::Index *flann_matcher;
00156
00157 Face(): flann_matcher(NULL){}
00158 #endif
00159 };
00160
00161 std::string Name;
00162 std::vector<Face> Faces;
00163 std::string Type;
00164
00165 protected:
00166
00173
00174
00180
00181
00182
00183 protected:
00184
00185
00186
00187
00189
00190
00191 VisualizationModel *m_visualization_model;
00192 };
00193
00194 #endif
00195