| 182 | } |
| 183 | |
| 184 | template <template <typename> class Storage> void |
| 185 | cloud_cb (const openni_wrapper::Image::Ptr& image, |
| 186 | const openni_wrapper::DepthImage::Ptr& depth_image, |
| 187 | float constant) |
| 188 | { |
| 189 | static double last = getTime (); |
| 190 | double now = getTime (); |
| 191 | { |
| 192 | std::cout << std::endl; |
| 193 | std::cout << "Average framerate: " << 1.0/double(now - last) << " Hz --- "; |
| 194 | last = now; |
| 195 | } |
| 196 | |
| 197 | static int smoothing_nr_iterations = 10; |
| 198 | static int smoothing_filter_size = 2; |
| 199 | static int enable_visualization = 1; |
| 200 | static int enable_mean_shift = 0; |
| 201 | static int enable_plane_fitting = 0; |
| 202 | static int meanshift_sp=8; |
| 203 | static int meanshift_sr=20; |
| 204 | static int meanshift_minsize=100; |
| 205 | |
| 206 | pcl::PointCloud<pcl::PointXYZRGB>::Ptr output (new pcl::PointCloud<pcl::PointXYZRGB>); |
| 207 | typename PointCloudAOS<Storage>::Ptr data; |
| 208 | |
| 209 | //ScopeTimeCPU timer ("All: "); |
| 210 | ScopeTimeCPU time ("everything"); |
| 211 | // Compute the PointCloud on the device |
| 212 | { |
| 213 | ScopeTimeCPU time ("disparity smoothing"); |
| 214 | d2c.compute<Storage> (depth_image, image, constant, data, false, 1, smoothing_nr_iterations, smoothing_filter_size); |
| 215 | } |
| 216 | |
| 217 | shared_ptr<typename Storage<float4>::type> normals; |
| 218 | { |
| 219 | ScopeTimeCPU time ("Normal Estimation"); |
| 220 | if (normal_method == 1) |
| 221 | normals = computeFastPointNormals<Storage> (data); |
| 222 | else |
| 223 | { |
| 224 | constexpr float focallength = 580/2.0; |
| 225 | normals = computePointNormals<Storage> (data->points.begin (), data->points.end (), focallength, data, radius_cm / 100.0f, nr_neighbors); |
| 226 | } |
| 227 | cudaDeviceSynchronize (); |
| 228 | } |
| 229 | |
| 230 | // retrieve normals as an image.. |
| 231 | typename ImageType<Storage>::type normal_image; |
| 232 | typename StoragePointer<Storage,char4>::type ptr; |
| 233 | { |
| 234 | ScopeTimeCPU time ("Matrix Creation"); |
| 235 | ImageType<Storage>::createContinuous ((int)data->height, (int)data->width, CV_8UC4, normal_image); |
| 236 | ptr = typename StoragePointer<Storage,char4>::type ((char4*)normal_image.data); |
| 237 | createNormalsImage<Storage> (ptr, *normals); |
| 238 | } |
| 239 | |
| 240 | //TODO: this breaks for pcl::cuda::Host |
| 241 | cv::Mat seg; |
nothing calls this directly
no test coverage detected