42#include <pcl/gpu/containers/device_array.h>
44#include <pcl/point_cloud.h>
48#include <pcl/gpu/kinfu_large_scale/tsdf_buffer.h>
50#include <pcl/gpu/kinfu_large_scale/point_intensity.h>
86 Header (
const Eigen::Vector3i &res,
const Eigen::Vector3f &size)
95 getVolumeSize ()
const {
return resolution[0] * resolution[1] * resolution[2]; };
97 friend inline std::ostream&
109 enum { DEFAULT_CLOUD_BUFFER_SIZE = 10 * 1000 * 1000 };
133 const Eigen::Vector3f&
137 const Eigen::Vector3i&
141 const Eigen::Vector3f
235 setHeader (
const Eigen::Vector3i& resolution,
const Eigen::Vector3f& volume_size) {
236 header_ =
Header (resolution, volume_size);
237 if (volume_host_->size() !=
this->
size())
238 pcl::console::print_warn (
"[TSDFVolume::setHeader] Header volume size (%d) doesn't fit underlying data size (%d)", volume_host_->size(), size());
244 return header_.getVolumeSize ();
253 const unsigned step = 2)
const;
256 inline const Eigen::Vector3i &
269 Eigen::Vector3f size_;
272 Eigen::Vector3i resolution_;
285 VolumePtr volume_host_;
286 WeightsPtr weights_host_;
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
shared_ptr< PointCloud< PointT > > Ptr
void downloadTsdfAndWeights(std::vector< float > &tsdf, std::vector< short > &weights) const
Downloads TSDF volume and according voxel weights from GPU memory.
void releaseVolume()
Releases tsdf buffer on GPU.
void downloadTsdfLocal() const
Downloads tsdf volume from GPU memory to local CPU buffer.
void setHeader(const Eigen::Vector3i &resolution, const Eigen::Vector3f &volume_size)
Set the header for data stored on host directly.
void fetchNormals(const DeviceArray< PointType > &cloud, DeviceArray< NormalType > &normals) const
Computes normals as gradient of tsdf for given points.
void pushSlice(const PointCloud< PointXYZI >::Ptr existing_data_cloud, const tsdf_buffer *buffer) const
Push a point cloud of previously scanned tsdf slice to the TSDF volume.
void setSize(const Eigen::Vector3f &size)
Sets Tsdf volume size for each dimension.
void downloadTsdf(std::vector< float > &tsdf) const
Downloads tsdf volume from GPU memory.
DeviceArray2D< int > data() const
Returns tsdf volume container that point to data in GPU memory.
std::size_t size() const
Returns overall number of voxels in grid stored on host.
bool load(const std::string &filename, bool binary=true)
Loads local volume from file.
void convertToTsdfCloud(pcl::PointCloud< pcl::PointXYZI >::Ptr &cloud, const unsigned step=2) const
Converts volume stored on host to cloud of TSDF values.
DeviceArray< PointType > fetchCloud(DeviceArray< PointType > &cloud_buffer) const
Generates cloud using GPU in connected6 mode only.
shared_ptr< TsdfVolume > Ptr
const Eigen::Vector3i & gridResolution() const
Returns the voxel grid resolution.
void fetchCloudHost(PointCloud< PointType > &cloud, bool connected26=false) const
Generates cloud using CPU (downloads volumetric representation to CPU memory)
const Eigen::Vector3i & getResolution() const
Returns volume resolution.
void fetchCloudHost(PointCloud< PointXYZI > &cloud, bool connected26=false) const
Generates cloud using CPU (downloads volumetric representation to CPU memory)
TsdfVolume(const Eigen::Vector3i &resolution)
Constructor.
void reset()
Resets tsdf volume data to uninitialized state.
void setTsdfTruncDist(float distance)
Sets Tsdf truncation distance.
void print_warn(const char *arg1, std::size_t size)
const Eigen::Vector3f & getSize() const
Returns volume size in meters.
const Eigen::Vector3f getVoxelSize() const
Returns volume voxel size in meters.
void downloadTsdfAndWeightsLocal() const
Downloads TSDF volume and according voxel weights from GPU memory to local CPU buffers.
std::size_t fetchSliceAsCloud(DeviceArray< PointType > &cloud_buffer_xyz, DeviceArray< float > &cloud_buffer_intensity, const tsdf_buffer *buffer, int shiftX, int shiftY, int shiftZ) const
Generates cloud using GPU in connected6 mode only.
void fetchNormals(const DeviceArray< PointType > &cloud, DeviceArray< PointType > &normals) const
Computes normals as gradient of tsdf for given points.
float getTsdfTruncDist() const
Returns tsdf truncation distance in meters.
bool save(const std::string &filename="tsdf_volume.dat", bool binary=true) const
Saves local volume buffer to file.
Defines all the PCL implemented PointT point type structures.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
PCL_EXPORTS void print_warn(const char *format,...)
Print a warning message on stream with colors.
Defines all the PCL and non-PCL macros used.
A point structure representing normal coordinates and the surface curvature estimate.
A point structure representing Euclidean xyz coordinates.
Structure to handle buffer addresses.