| 200 | } |
| 201 | |
| 202 | void |
| 203 | compute (const PointCloudXYZRGBA::ConstPtr & input, float min_depth, float max_depth, float max_height, |
| 204 | const std::string & template_pcd_filename, const std::string & template_sqmmt_filename) |
| 205 | { |
| 206 | // Segment the foreground object |
| 207 | std::vector<bool> foreground_mask = maskForegroundPoints (input, min_depth, max_depth, max_height); |
| 208 | |
| 209 | // Save the masked template cloud (masking with NaNs to preserve its organized structure) |
| 210 | PointCloudXYZRGBA template_cloud (*input); |
| 211 | for (std::size_t i = 0; i < foreground_mask.size (); ++i) |
| 212 | { |
| 213 | if (!foreground_mask[i]) |
| 214 | { |
| 215 | pcl::PointXYZRGBA & p = template_cloud[i]; |
| 216 | p.x = p.y = p.z = std::numeric_limits<float>::quiet_NaN (); |
| 217 | } |
| 218 | } |
| 219 | pcl::io::savePCDFile (template_pcd_filename, template_cloud); |
| 220 | |
| 221 | // Create a LINEMOD template |
| 222 | pcl::LINEMOD linemod; |
| 223 | trainTemplate (input, foreground_mask, linemod); |
| 224 | |
| 225 | // Save the LINEMOD template |
| 226 | linemod.saveTemplates (template_sqmmt_filename.c_str()); |
| 227 | } |
| 228 | |
| 229 | /* ---[ */ |
| 230 | int |
no test coverage detected