|
@@ -98,14 +98,42 @@ bool PointCloudDensification::enqueuePointCloud(
|
|
|
//}
|
|
|
|
|
|
|
|
|
+
|
|
|
void PointCloudDensification::enqueue(const pcl::PointCloud<pcl::PointXYZI>::Ptr & pc_ptr)
|
|
|
{
|
|
|
+ int npsize = pc_ptr->width * pc_ptr->height;
|
|
|
+ int nsize = npsize * 13;
|
|
|
+
|
|
|
+ std::cout<<"width: "<<pc_ptr->width<<" height: "<<pc_ptr->height<<std::endl;
|
|
|
+
|
|
|
+ char * pdata = new char[nsize];
|
|
|
+
|
|
|
+ int i;
|
|
|
+ for(i=0;i<npsize;i++)
|
|
|
+ {
|
|
|
+ float x,y,z;
|
|
|
+ unsigned char nintensity;
|
|
|
+ pcl::PointXYZI point = pc_ptr->at(i);
|
|
|
+ x = point.x; y = point.y; z = point.z; nintensity = point.intensity;
|
|
|
+ memcpy(pdata+i*13+0,&x,4);memcpy(pdata+i*13+4,&y,4);memcpy(pdata+i*13+8,&z,4);memcpy(pdata+i*13+12,&nintensity,1);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// auto data_d = cuda::make_unique<uint8_t[]>(
|
|
|
+// sizeof(uint8_t) * pc_ptr->width * pc_ptr->height * sizeof(pcl::PointXYZI) / sizeof(uint8_t));
|
|
|
+
|
|
|
auto data_d = cuda::make_unique<uint8_t[]>(
|
|
|
- sizeof(uint8_t) * pc_ptr->width * pc_ptr->height * sizeof(pcl::PointXYZI) / sizeof(uint8_t));
|
|
|
+ sizeof(uint8_t) * pc_ptr->width * pc_ptr->height * 13 / sizeof(uint8_t));
|
|
|
|
|
|
CHECK_CUDA_ERROR(cudaMemcpyAsync(
|
|
|
- data_d.get(), pc_ptr->points.data(), sizeof(uint8_t) * pc_ptr->width * pc_ptr->height * sizeof(pcl::PointXYZI),
|
|
|
+ data_d.get(), pdata, sizeof(uint8_t) * pc_ptr->width * pc_ptr->height * 13,
|
|
|
cudaMemcpyHostToDevice, stream_));
|
|
|
+
|
|
|
+ delete pdata;
|
|
|
+
|
|
|
+// CHECK_CUDA_ERROR(cudaMemcpyAsync(
|
|
|
+// data_d.get(), pc_ptr->points.data(), sizeof(uint8_t) * pc_ptr->width * pc_ptr->height * sizeof(pcl::PointXYZI),
|
|
|
+// cudaMemcpyHostToDevice, stream_));
|
|
|
// CHECK_CUDA_ERROR(cudaMemcpyAsync(
|
|
|
// data_d.get(), pc_ptr->data(), sizeof(uint8_t) * pc_ptr->width * pc_ptr->height * sizeof(pcl::PointXYZI),
|
|
|
// cudaMemcpyHostToDevice, stream_));
|