42 #ifndef __PCL_IO_IMAGE_GRABBER__
43 #define __PCL_IO_IMAGE_GRABBER__
45 #include "pcl/pcl_config.h"
46 #include <pcl/io/grabber.h>
47 #include <pcl/io/file_grabber.h>
48 #include <pcl/common/time_trigger.h>
51 #include <pcl/conversions.h>
66 ImageGrabberBase (
const std::string& directory,
float frames_per_second,
bool repeat,
bool pclzf_mode);
68 ImageGrabberBase (
const std::string& depth_directory,
const std::string& rgb_directory,
float frames_per_second,
bool repeat);
74 ImageGrabberBase (
const std::vector<std::string>& depth_image_files,
float frames_per_second,
bool repeat);
125 getFramesPerSecond () const;
133 atLastFrame () const;
137 getCurrentDepthFileName () const;
142 getPrevDepthFileName () const;
146 getDepthFileNameAtIndex (
size_t idx) const;
150 getTimestampAtIndex (
size_t idx, uint64_t ×tamp) const;
156 setRGBImageFiles (const std::vector<std::
string>& rgb_image_files);
165 setCameraIntrinsics (const
double focal_length_x,
166 const
double focal_length_y,
167 const
double principal_point_x,
168 const
double principal_point_y);
177 getCameraIntrinsics (
double &focal_length_x,
178 double &focal_length_y,
179 double &principal_point_x,
180 double &principal_point_y) const;
185 setDepthImageUnits (
float units);
190 setNumberOfThreads (
unsigned int nr_threads = 0);
199 getCloudAt (
size_t idx, pcl::
PCLPointCloud2 &blob, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation) const;
204 publish (const pcl::
PCLPointCloud2& blob, const Eigen::Vector4f& origin, const Eigen::Quaternionf& orientation) const = 0;
208 struct ImageGrabberImpl;
209 ImageGrabberImpl* impl_;
218 float frames_per_second = 0,
220 bool pclzf_mode =
false);
223 const std::string& rgb_dir,
224 float frames_per_second = 0,
225 bool repeat =
false);
227 ImageGrabber (
const std::vector<std::string>& depth_image_files,
228 float frames_per_second = 0,
229 bool repeat =
false);
235 const boost::shared_ptr< const pcl::PointCloud<PointT> >
236 operator[] (
size_t idx)
const;
245 const Eigen::Vector4f& origin,
246 const Eigen::Quaternionf& orientation)
const;
247 boost::signals2::signal<void (const boost::shared_ptr<const pcl::PointCloud<PointT> >&)>* signal_;
251 template<
typename Po
intT>
253 float frames_per_second,
258 signal_ = createSignal<void (const boost::shared_ptr<const pcl::PointCloud<PointT> >&)>();
262 template<
typename Po
intT>
264 const std::string& rgb_dir,
265 float frames_per_second,
269 signal_ = createSignal<void (const boost::shared_ptr<const pcl::PointCloud<PointT> >&)>();
273 template<
typename Po
intT>
275 float frames_per_second,
277 :
ImageGrabberBase (depth_image_files, frames_per_second, repeat), signal_ ()
279 signal_ = createSignal<void (const boost::shared_ptr<const pcl::PointCloud<PointT> >&)>();
283 template<
typename Po
intT>
const boost::shared_ptr< const pcl::PointCloud<PointT> >
287 Eigen::Vector4f origin;
288 Eigen::Quaternionf orientation;
289 getCloudAt (idx, blob, origin, orientation);
298 template <
typename Po
intT>
size_t
301 return (numFrames ());
305 template<
typename Po
intT>
void
313 signal_->operator () (cloud);
Grabber interface for PCL 1.x device drivers.
size_t size() const
size Returns the number of clouds currently loaded by the grabber
virtual void publish(const pcl::PCLPointCloud2 &blob, const Eigen::Vector4f &origin, const Eigen::Quaternionf &orientation) const
virtual ~ImageGrabber()
Empty destructor.
boost::shared_ptr< PointCloud< PointT > > Ptr
const boost::shared_ptr< const pcl::PointCloud< PointT > > operator[](size_t idx) const
operator[] Returns the idx-th cloud in the dataset, without bounds checking.
ImageGrabber(const std::string &dir, float frames_per_second=0, bool repeat=false, bool pclzf_mode=false)
ImageGrabberBase(const ImageGrabberBase &src)
Copy constructor.
Eigen::Vector4f sensor_origin_
Sensor acquisition pose (origin/translation).
Base class for Image file grabber.
void fromPCLPointCloud2(const pcl::PCLPointCloud2 &msg, pcl::PointCloud< PointT > &cloud, const MsgFieldMap &field_map)
Convert a PCLPointCloud2 binary data blob into a pcl::PointCloud object using a field_map...
A point structure representing Euclidean xyz coordinates, and the RGB color.
Eigen::Quaternionf sensor_orientation_
Sensor acquisition pose (rotation).
PointCloud represents the base class in PCL for storing collections of 3D points. ...
boost::signals2::signal< void(const boost::shared_ptr< const pcl::PointCloud< PointT > > &)> * signal_
FileGrabber provides a container-style interface for grabbers which operate on fixed-size input...