bool
DeviceVolume::getVolume (pcl::TSDFVolume<VoxelT, WeightT>::Ptr &volume)
{
    int volume_size = device_volume_.rows() * device_volume_.cols();

    if ((size_t)volume_size != volume->size())
    {
        pc::print_error ("Device volume size (%d) and tsdf volume size (%d) don't match. ABORTING!\n", volume_size, volume->size());
        return false;
    }

    vector<VoxelT>&  volume_vec  = volume->volumeWriteable();
    vector<WeightT>& weights_vec = volume->weightsWriteable();

    device_volume_.download (&volume_vec[0], device_volume_.cols() * sizeof(int));

    #pragma omp parallel for
    for(int i = 0; i < (int) volume->size(); ++i)
    {
        short2 *elem = (short2*)&volume_vec[i];
        volume_vec[i]  = (float)(elem->x)/pcl::device::DIVISOR;
        weights_vec[i] = (short)(elem->y);
    }

    return true;
}
Beispiel #2
0
template<typename T> void 
savePNGFile(const std::string& filename, const pcl::gpu::DeviceArray2D<T>& arr)
{
  int c;
  pcl::PointCloud<T> cloud(arr.cols(), arr.rows());
  arr.download(cloud.points, c);
  pcl::io::savePNGFile(filename, cloud);
}
template <typename T> void
savePCDFile (const std::string& filename, const pcl::gpu::DeviceArray2D<T>& arr)
{
    int c;
    pcl::PointCloud<T> cloud(arr.cols(), arr.rows());
    arr.download(cloud.points, c);
    
    cloud.is_dense = false;
    cloud.points.resize (cloud.width * cloud.height);

    
    pcl::io::savePCDFileASCII(filename, cloud);
      cout << "devarr2d\n";
}