recognitionmodel.h
Go to the documentation of this file.
00001 
00031 #ifndef RECOGNITIONMODEL_H
00032 #define RECOGNITIONMODEL_H
00033 
00034 #include <cv.h>
00035 
00036 #include <vector>
00037 
00038 #include <pcl/point_cloud.h>
00039 #include <pcl/point_types.h>
00040 
00041 // Enable this define to show debug visualization
00042 //#define DEBUG_VIS
00043 
00044 #ifdef DEBUG_VIS
00045 #include <highgui.h>
00046 #endif
00047 
00048 typedef pcl::PointXYZRGB PointType;
00049 typedef pcl::PointCloud<PointType> PointCloud;
00050 
00057 class ObjectAspect {
00058 public:
00059     ObjectAspect();
00060 
00066     int calculate(const cv::Mat& image, const PointCloud::Ptr& pointcloud);
00067 
00072     void fromFile(const std::string& filename);
00073     void plotKeypoints(cv::Mat &image);
00079     void findCorrespondences(const ObjectAspect& other, std::vector<cv::Point2i>& ptpairs);
00080 
00089     static int naiveNearestNeighbor(const float* vec, const std::vector<cv::KeyPoint>& model_keypoints,
00090                              const float* model_descriptors, const std::map<int,int>& imageMap2D3D);
00091 
00100     static double compareSURFDescriptors(const float* d1, const float* d2, double best, int length);
00101 
00108     double matchAspects(ObjectAspect& other, Eigen::Matrix4f& transform);
00109 
00111     std::vector<cv::KeyPoint> keypoints;
00113     std::vector<float> descriptors;
00115     std::map<int,int> map2D3D;
00117     std::map<int,int> map2D3Dinv;
00119     PointCloud::Ptr keypoints3D;
00120 
00122     cv::Mat image;
00124     PointCloud::Ptr points;
00125     ObjectAspect* match;
00126 };
00127 
00132 class RecognitionModel
00133 {
00134 public:
00135     RecognitionModel();
00136 
00142     bool loadFromPath(const std::string& path);
00143 
00144     std::vector<ObjectAspect*> aspects;
00152     bool matchAspects(ObjectAspect& other, Eigen::Matrix4f& model2scene);
00153     std::string model_name;
00154 };
00155 
00156 #endif // RECOGNITIONMODEL_H


re_kinect_object_detector
Author(s): Andreas Koch
autogenerated on Sun Jan 5 2014 11:38:30