void S2ObjectViewer::display() { LOG(LTRACE) << "S2ObjectViewer::display"; pcl::PointCloud<pcl::PointXYZRGB>::Ptr in_cloud_1_temp = in_cloud.read(); pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_1(new pcl::PointCloud<pcl::PointXYZ>()); pcl::copyPointCloud(*in_cloud_1_temp, *cloud_1); pcl::PointCloud<PointXYZSHOT>::Ptr shots = in_shots.read(); pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_2(new pcl::PointCloud<pcl::PointXYZ>()); pcl::copyPointCloud(*shots, *cloud_2); pcl::PointCloud<PointXYZSIFT>::Ptr sifts = in_sifts.read(); pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_3(new pcl::PointCloud<pcl::PointXYZ>()); pcl::copyPointCloud(*sifts, *cloud_3); std::vector<int> indices; cloud_1->is_dense = false; pcl::removeNaNFromPointCloud(*cloud_1, *cloud_1, indices); viewer->removeAllPointClouds(); pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> blue ( cloud_1, cloud_r, cloud_g, cloud_b); pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> green ( cloud_2, shot_r, shot_g, shot_b); pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> red ( cloud_3, sift_r, sift_g, sift_b); viewer->addPointCloud<pcl::PointXYZ> (cloud_1, blue, "cloud"); viewer->addPointCloud<pcl::PointXYZ> (cloud_2, green, "shots"); viewer->addPointCloud<pcl::PointXYZ> (cloud_3, red, "sifts"); viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, cloud_size, "cloud"); viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, sift_size, "sifts"); viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, shot_size, "shots"); }
PointCloudPtr cutNearCenter(PointCloudPtr cloud, PointT center) { PointCloudPtr cloud_1(new PointCloud), cloud_2(new PointCloud), cloud_3(new PointCloud); pcl::PassThrough<PointT> pass; pass.setInputCloud(cloud); pass.setFilterFieldName("x"); pass.setFilterLimits(center.x-maxWidth/2, center.x+maxWidth/2); pass.filter(*cloud_1); pass.setInputCloud(cloud_1); pass.setFilterFieldName("y"); pass.setFilterLimits(center.y, center.y+maxHeight+2); pass.filter(*cloud_2); pass.setInputCloud(cloud_2); pass.setFilterFieldName("z"); pass.setFilterLimits(center.z-maxWidth/2, center.z+plusDepth); pass.filter(*cloud_3); movePointCloud(cloud_3, -center.x, -center.y, -center.z); zoomPointCloud(cloud_3, 1, 1, zZoom); return cloud_3; }