149 typedef std::map <unsigned int, std::vector<std::vector<MlFeature> > >
SamplesMap;
154 cv::Ptr<cv::ml::KNearest> m_knn;
156 cv::Ptr<cv::ml::NormalBayesClassifier> m_bayes;
157 cv::Ptr<cv::ml::SVM> m_svm;
158 cv::Ptr<cv::ml::DTrees> m_dt;
159 cv::Ptr<cv::ml::RTrees> m_rt;
160 cv::Ptr<cv::ml::Boost> m_boost;
161 cv::Ptr<cv::ml::ANN_MLP> m_ann;
163 std::vector<std::string> m_categories;
164 std::vector<std::vector<float>> m_lastDetected;
168 boost::thread* m_trainingThread;
169 boost::mutex m_trainingCriticalSection;
171 boost::thread* m_detectionThread;
172 boost::mutex m_detectionCriticalSection;
174 unsigned int m_featurePerSample;
178 unsigned int m_nbAnchorPoints;
182 std::vector<std::vector<MlFeature>> m_dataHistory;
183 bool m_newHistoryData;
218 m_categories = names;
241 void Load(std::string filename);
245 void Save(std::string saveFile);
251 void AddTrainingData(std::vector<cv::Point3d> input, std::string label);
263 void Reconize(cv::Mat reconizeIn, cv::Mat reconizeOut);
278 void TrainingThread();
279 void DetectionThread();
284 int Evaluate(cv::Mat& predicted,
float &accuracy);
286 std::vector<std::vector<MlFeature>> ComputeData(std::vector<std::vector<MlFeature>> ldata);
287 void ValidateDetectedData();