8 #ifndef PCL_RF_FACE_DETECTOR_TRAINER_H_ 9 #define PCL_RF_FACE_DETECTOR_TRAINER_H_ 11 #include "pcl/recognition/face_detection/face_detector_data_provider.h" 12 #include "pcl/recognition/face_detection/rf_face_utils.h" 13 #include "pcl/ml/dt/decision_forest.h" 14 #include <pcl/features/integral_image2D.h> 25 std::string forest_filename_;
29 float trans_max_variance_;
30 size_t min_votes_size_;
33 std::string directory_;
34 float HEAD_ST_DIAMETER_;
35 float larger_radius_ratio_;
36 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > head_center_votes_;
37 std::vector<std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > > head_center_votes_clustered_;
38 std::vector<std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > > head_center_original_votes_clustered_;
39 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > angle_votes_;
40 std::vector<float> uncertainties_;
41 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > head_clusters_centers_;
42 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > head_clusters_rotation_;
50 std::string model_path_;
51 bool pose_refinement_;
65 forest_filename_ = std::string (
"forest.txt");
69 trans_max_variance_ = 1600.f;
70 used_for_pose_ = std::numeric_limits<int>::max ();
72 directory_ = std::string (
"");
73 HEAD_ST_DIAMETER_ = 0.2364f;
74 larger_radius_ratio_ = 1.5f;
75 face_heat_map_.reset ();
76 model_path_ = std::string (
"face_mesh.ply");
77 pose_refinement_ =
false;
91 forest_filename_ = ff;
131 void setModelPath(std::string & model);
135 pose_refinement_ = do_it;
136 icp_iterations_ = iters;
146 trans_max_variance_ = max;
156 min_votes_size_ = mv;
175 heat_map = face_heat_map_;
181 votes_cloud->
points.resize (head_center_votes_.size ());
182 votes_cloud->
width = static_cast<int>(head_center_votes_.size ());
185 for (
size_t i = 0; i < head_center_votes_.size (); i++)
187 votes_cloud->
points[i].getVector3fMap () = head_center_votes_[i];
193 votes_cloud->
points.resize (head_center_votes_.size ());
194 votes_cloud->
width = static_cast<int>(head_center_votes_.size ());
198 for (
size_t i = 0; i < head_center_votes_clustered_.size (); i++)
200 for (
size_t j = 0; j < head_center_votes_clustered_[i].size (); j++, p++)
202 votes_cloud->
points[p].getVector3fMap () = head_center_votes_clustered_[i][j];
203 votes_cloud->
points[p].intensity = 0.1f * static_cast<float> (i);
207 votes_cloud->
points.resize (p);
212 votes_cloud->
points.resize (head_center_votes_.size ());
213 votes_cloud->
width = static_cast<int>(head_center_votes_.size ());
217 for (
size_t i = 0; i < head_center_original_votes_clustered_.size (); i++)
219 for (
size_t j = 0; j < head_center_original_votes_clustered_[i].size (); j++, p++)
221 votes_cloud->
points[p].getVector3fMap () = head_center_original_votes_clustered_[i][j];
222 votes_cloud->
points[p].intensity = 0.1f * static_cast<float> (i);
226 votes_cloud->
points.resize (p);
232 for (
size_t i = 0; i < head_clusters_centers_.size (); i++)
234 Eigen::VectorXf head (6);
235 head[0] = head_clusters_centers_[i][0];
236 head[1] = head_clusters_centers_[i][1];
237 head[2] = head_clusters_centers_[i][2];
238 head[3] = head_clusters_rotation_[i][0];
239 head[4] = head_clusters_rotation_[i][1];
240 head[5] = head_clusters_rotation_[i][2];
241 faces.push_back (head);
254 face_heat_map_ = heat_map;
257 void trainWithDataProvider();
258 void faceVotesClustering();
Class representing a decision forest.
void setInputCloud(pcl::PointCloud< pcl::PointXYZ >::Ptr &cloud)
void setForestFilename(std::string &ff)
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
void setUseNormals(bool use)
void setNumTrees(int num)
This file defines compatibility wrappers for low level I/O functions.
void setNumVotesUsedForPose(int n)
void setFaceMinVotes(int mv)
void getDetectedFaces(std::vector< Eigen::VectorXf > &faces)
void setForest(pcl::DecisionForest< NodeType > &forest)
uint32_t height
The point cloud height (if organized as an image-structure).
void setNumFeatures(int num)
void getVotes(pcl::PointCloud< pcl::PointXYZ >::Ptr &votes_cloud)
boost::shared_ptr< PointCloud< PointT > > Ptr
uint32_t width
The point cloud width (if organized as an image-structure).
void setNumTrainingImages(int num)
void setDirectory(std::string &dir)
void setLeavesFaceMaxVariance(float max)
void getFaceHeatMap(pcl::PointCloud< pcl::PointXYZI >::Ptr &heat_map)
void setLeavesFaceThreshold(float p)
void setFaceHeatMapCloud(pcl::PointCloud< pcl::PointXYZI >::Ptr &heat_map)
void getVotes2(pcl::PointCloud< pcl::PointXYZI >::Ptr &votes_cloud)
void getVotes(pcl::PointCloud< pcl::PointXYZI >::Ptr &votes_cloud)
void setPoseRefinement(bool do_it, int iters=5)
virtual ~RFFaceDetectorTrainer()