Skip to content

Commit e816414

Browse files
authored
Merge pull request #5669 from mvieth/improve_pcl_openni_face_detector
[apps] Improve pcl_openni_face_detector
2 parents 2934ff5 + 75d9676 commit e816414

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apps/src/face_detection/openni_face_detection.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ main(int argc, char** argv)
103103
int pose_refinement_ = 0;
104104
int icp_iterations = 5;
105105

106-
std::string forest_fn = "../data/forests/forest.txt";
107-
std::string model_path_ = "../data/ply_models/face.pcd";
106+
// Use for example biwi_face_database from https://github.com/PointCloudLibrary/data
107+
std::string forest_fn = "../data/biwi_face_database/forest_example.txt";
108+
std::string model_path_ = "../data/biwi_face_database/model.pcd";
108109

109110
pcl::console::parse_argument(argc, argv, "-forest_fn", forest_fn);
110111
pcl::console::parse_argument(argc, argv, "-max_variance", trans_max_variance);
@@ -119,7 +120,6 @@ main(int argc, char** argv)
119120
pcl::console::parse_argument(argc, argv, "-icp_iterations", icp_iterations);
120121

121122
pcl::RFFaceDetectorTrainer fdrf;
122-
fdrf.setForestFilename(forest_fn);
123123
fdrf.setWSize(80);
124124
fdrf.setUseNormals(static_cast<bool>(use_normals));
125125
fdrf.setWStride(STRIDE_SW);
@@ -134,7 +134,10 @@ main(int argc, char** argv)
134134

135135
// load forest from file and pass it to the detector
136136
std::filebuf fb;
137-
fb.open(forest_fn.c_str(), std::ios::in);
137+
if (!fb.open(forest_fn.c_str(), std::ios::in)) {
138+
PCL_ERROR("Could not open file %s\n", forest_fn.c_str());
139+
return 1;
140+
}
138141
std::istream os(&fb);
139142

140143
using NodeType = pcl::face_detection::RFTreeNode<pcl::face_detection::FeatureType>;

0 commit comments

Comments
 (0)