38 #ifndef PCL_KINFU_TSDF_VOLUME_H_ 39 #define PCL_KINFU_TSDF_VOLUME_H_ 41 #include <pcl/pcl_macros.h> 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 typedef boost::shared_ptr<TsdfVolume>
Ptr;
81 volume_element_size (sizeof(float)),
82 weights_element_size (sizeof(short))
85 Header (
const Eigen::Vector3i &res,
const Eigen::Vector3f &size)
88 volume_element_size (sizeof(float)),
89 weights_element_size (sizeof(short))
94 getVolumeSize ()
const {
return resolution[0] * resolution[1] * resolution[2]; };
96 friend inline std::ostream&
99 os <<
"(resolution = " << h.
resolution.transpose() <<
", volume size = " << h.
volume_size.transpose() <<
")";
104 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
108 enum { DEFAULT_CLOUD_BUFFER_SIZE = 10 * 1000 * 1000 };
113 TsdfVolume (
const Eigen::Vector3i& resolution);
119 setSize (
const Eigen::Vector3f& size);
132 const Eigen::Vector3f&
136 const Eigen::Vector3i&
137 getResolution()
const;
140 const Eigen::Vector3f
141 getVoxelSize ()
const;
145 getTsdfTruncDist ()
const;
210 downloadTsdf (std::vector<float>& tsdf)
const;
214 downloadTsdfLocal ()
const;
221 downloadTsdfAndWeights (std::vector<float>& tsdf, std::vector<short>& weights)
const;
225 downloadTsdfAndWeightsLocal ()
const;
230 void print_warn(
const char* arg1,
size_t size);
234 setHeader (
const Eigen::Vector3i& resolution,
const Eigen::Vector3f& volume_size) {
235 header_ =
Header (resolution, volume_size);
236 if (volume_host_->size() != this->size())
237 pcl::console::print_warn (
"[TSDFVolume::setHeader] Header volume size (%d) doesn't fit underlying data size (%d)", volume_host_->size(), size());
243 return header_.getVolumeSize ();
252 const unsigned step = 2)
const;
255 inline const Eigen::Vector3i &
260 save (
const std::string &filename =
"tsdf_volume.dat",
bool binary =
true)
const;
264 load (
const std::string &filename,
bool binary =
true);
268 Eigen::Vector3f size_;
271 Eigen::Vector3i resolution_;
281 typedef boost::shared_ptr<std::vector<float> > VolumePtr;
282 typedef boost::shared_ptr<std::vector<short> > WeightsPtr;
285 VolumePtr volume_host_;
286 WeightsPtr weights_host_;
288 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
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.
PCL_EXPORTS int load(const std::string &file_name, pcl::PCLPointCloud2 &blob)
Load a file into a PointCloud2 according to extension.
Structure to handle buffer addresses.
This file defines compatibility wrappers for low level I/O functions.
PointXYZ PointType
Supported Point Types.
size_t size() const
Returns overall number of voxels in grid stored on host.
boost::shared_ptr< PointCloud< PointT > > Ptr
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)
boost::shared_ptr< TsdfVolume > Ptr
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.
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.
std::ostream & operator<<(std::ostream &os, const float3 &v1)