| 19 | |
| 20 | template <class PointInT> |
| 21 | void |
| 22 | run(pcl::RFFaceDetectorTrainer& fdrf, |
| 23 | typename pcl::PointCloud<PointInT>::Ptr& scene_vis, |
| 24 | pcl::visualization::PCLVisualizer& vis, |
| 25 | bool heat_map, |
| 26 | bool show_votes, |
| 27 | const std::string& filename) |
| 28 | { |
| 29 | pcl::PointCloud<pcl::PointXYZ>::Ptr scene(new pcl::PointCloud<pcl::PointXYZ>); |
| 30 | pcl::copyPointCloud(*scene_vis, *scene); |
| 31 | |
| 32 | fdrf.setInputCloud(scene); |
| 33 | |
| 34 | if (heat_map) { |
| 35 | pcl::PointCloud<pcl::PointXYZI>::Ptr intensity_cloud( |
| 36 | new pcl::PointCloud<pcl::PointXYZI>); |
| 37 | fdrf.setFaceHeatMapCloud(intensity_cloud); |
| 38 | } |
| 39 | |
| 40 | fdrf.detectFaces(); |
| 41 | |
| 42 | using FieldListM = typename pcl::traits::fieldList<PointInT>::type; |
| 43 | |
| 44 | float rgb_m; |
| 45 | bool exists_m; |
| 46 | pcl::for_each_type<FieldListM>( |
| 47 | pcl::CopyIfFieldExists<PointInT, float>((*scene_vis)[0], "rgb", exists_m, rgb_m)); |
| 48 | |
| 49 | std::cout << "Color exists:" << static_cast<int>(exists_m) << std::endl; |
| 50 | if (exists_m) { |
| 51 | pcl::PointCloud<pcl::PointXYZRGB>::Ptr to_visualize( |
| 52 | new pcl::PointCloud<pcl::PointXYZRGB>); |
| 53 | pcl::copyPointCloud(*scene_vis, *to_visualize); |
| 54 | |
| 55 | pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> |
| 56 | handler_keypoints(to_visualize); |
| 57 | vis.addPointCloud<pcl::PointXYZRGB>(to_visualize, handler_keypoints, "scene_cloud"); |
| 58 | } |
| 59 | else { |
| 60 | vis.addPointCloud(scene_vis, "scene_cloud"); |
| 61 | } |
| 62 | |
| 63 | if (heat_map) { |
| 64 | pcl::PointCloud<pcl::PointXYZI>::Ptr intensity_cloud( |
| 65 | new pcl::PointCloud<pcl::PointXYZI>); |
| 66 | fdrf.getFaceHeatMap(intensity_cloud); |
| 67 | |
| 68 | pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZI> |
| 69 | handler_keypoints(intensity_cloud, "intensity"); |
| 70 | vis.addPointCloud<pcl::PointXYZI>(intensity_cloud, handler_keypoints, "heat_map"); |
| 71 | } |
| 72 | |
| 73 | if (show_votes) { |
| 74 | |
| 75 | pcl::PointCloud<pcl::PointXYZI>::Ptr votes_cloud( |
| 76 | new pcl::PointCloud<pcl::PointXYZI>()); |
| 77 | fdrf.getVotes2(votes_cloud); |
| 78 | pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZI> |
nothing calls this directly
no test coverage detected