40 #include "pcl/recognition/hv/occlusion_reasoning.h"
41 #include "pcl/recognition/impl/hv/occlusion_reasoning.hpp"
42 #include <pcl/search/kdtree.h>
43 #include <pcl/filters/voxel_grid.h>
53 template<
typename ModelT,
typename SceneT>
134 zbuffer_scene_resolution_ = 100;
135 zbuffer_self_occlusion_resolution_ = 150;
136 resolution_ = 0.005f;
137 inliers_threshold_ =
static_cast<float>(resolution_);
138 occlusion_cloud_set_ =
false;
139 occlusion_thres_ = 0.005f;
140 normals_set_ =
false;
141 requires_normals_ =
false;
148 return requires_normals_;
166 occlusion_thres_ = t;
175 inliers_threshold_ = r;
198 complete_models_ = complete_models;
209 complete_normal_models_ = complete_models;
222 if(!occlusion_cloud_set_) {
223 PCL_WARN(
"Occlusion cloud not set, using scene_cloud instead...\n");
224 occlusion_cloud_ = scene_cloud_;
227 if (!occlusion_reasoning)
228 visible_models_ = models;
232 if (scene_cloud_ ==
nullptr)
234 PCL_ERROR(
"setSceneCloud should be called before adding the model if reasoning about occlusions...\n");
239 PCL_WARN(
"Scene not organized... filtering using computed depth buffer\n");
248 for (std::size_t i = 0; i < models.size (); i++)
255 std::vector<int> indices;
256 zbuffer_self_occlusion.
filter (models[i], indices, 0.005f);
259 if(normals_set_ && requires_normals_) {
262 visible_normal_models_.push_back(filtered_normals);
270 filtered = pcl::occlusion_reasoning::filter<ModelT,SceneT> (occlusion_cloud_, const_filtered, 525.f, occlusion_thres_);
274 zbuffer_scene.
filter (const_filtered, filtered, occlusion_thres_);
277 visible_models_.push_back (filtered);
280 complete_models_ = models;
283 occlusion_cloud_set_ =
false;
284 normals_set_ =
false;
296 complete_models_.clear();
297 visible_models_.clear();
298 visible_normal_models_.clear();
300 scene_cloud_ = scene_cloud;
305 voxel_grid.
setLeafSize (resolution_, resolution_, resolution_);
307 voxel_grid.
filter (*scene_cloud_downsampled_);
311 scene_downsampled_tree_->
setInputCloud(scene_cloud_downsampled_);
316 occlusion_cloud_ = occ_cloud;
317 occlusion_cloud_set_ =
true;