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> 65 using Ptr = shared_ptr<TsdfVolume>;
82 volume_element_size (sizeof(float)),
83 weights_element_size (sizeof(short))
86 Header (
const Eigen::Vector3i &res,
const Eigen::Vector3f &size)
89 volume_element_size (sizeof(float)),
90 weights_element_size (sizeof(short))
95 getVolumeSize ()
const {
return resolution[0] * resolution[1] * resolution[2]; };
97 friend inline std::ostream&
100 os <<
"(resolution = " << h.
resolution.transpose() <<
", volume size = " << h.
volume_size.transpose() <<
")";
109 enum { DEFAULT_CLOUD_BUFFER_SIZE = 10 * 1000 * 1000 };
114 TsdfVolume (
const Eigen::Vector3i& resolution);
120 setSize (
const Eigen::Vector3f& size);
133 const Eigen::Vector3f&
137 const Eigen::Vector3i&
138 getResolution()
const;
141 const Eigen::Vector3f
142 getVoxelSize ()
const;
146 getTsdfTruncDist ()
const;
211 downloadTsdf (std::vector<float>& tsdf)
const;
215 downloadTsdfLocal ()
const;
222 downloadTsdfAndWeights (std::vector<float>& tsdf, std::vector<short>& weights)
const;
226 downloadTsdfAndWeightsLocal ()
const;
231 void print_warn(
const char* arg1, std::size_t size);
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 &
261 save (
const std::string &filename =
"tsdf_volume.dat",
bool binary =
true)
const;
265 load (
const std::string &filename,
bool binary =
true);
269 Eigen::Vector3f size_;
272 Eigen::Vector3i resolution_;
281 using VolumePtr = shared_ptr<std::vector<float> >;
282 using WeightsPtr = shared_ptr<std::vector<short> >;
285 VolumePtr volume_host_;
286 WeightsPtr weights_host_;
A point structure representing normal coordinates and the surface curvature estimate.
void setHeader(const Eigen::Vector3i &resolution, const Eigen::Vector3f &volume_size)
Set the header for data stored on host directly.
shared_ptr< const TsdfVolume > ConstPtr
PCL_EXPORTS int load(const std::string &file_name, pcl::PCLPointCloud2 &blob)
Load a file into a PointCloud2 according to extension.
shared_ptr< PointCloud< PointT > > Ptr
Defines functions, macros and traits for allocating and using memory.
Structure to handle buffer addresses.
shared_ptr< TsdfVolume > Ptr
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
const Eigen::Vector3i & gridResolution() const
Returns the voxel grid resolution.
Defines all the PCL implemented PointT point type structures.
A point structure representing Euclidean xyz coordinates.
float distance(const PointT &p1, const PointT &p2)
PointCloud represents the base class in PCL for storing collections of 3D points. ...
PCL_EXPORTS void print_warn(const char *format,...)
Print a warning message on stream with colors.
void releaseVolume()
Releases tsdf buffer on GPU.
std::size_t size() const
Returns overall number of voxels in grid stored on host.
PCL_EXPORTS int save(const std::string &file_name, const pcl::PCLPointCloud2 &blob, unsigned precision=5)
Save point cloud data to a binary file when available else to ASCII.
Defines all the PCL and non-PCL macros used.
std::ostream & operator<<(std::ostream &os, const float3 &v1)