43#include <pcl/conversions.h>
45#include <pcl/pcl_config.h>
46#include <pcl/common/time_trigger.h>
47#include <pcl/io/grabber.h>
48#include <pcl/io/file_grabber.h>
68 ImageGrabberBase (
const std::string& directory,
float frames_per_second,
bool repeat,
bool pclzf_mode);
70 ImageGrabberBase (
const std::string& depth_directory,
const std::string& rgb_directory,
float frames_per_second,
bool repeat);
76 ImageGrabberBase (
const std::vector<std::string>& depth_image_files,
float frames_per_second,
bool repeat);
150 const
double focal_length_y,
151 const
double principal_point_x,
152 const
double principal_point_y);
162 double &focal_length_y,
163 double &principal_point_x,
164 double &principal_point_y) const;
193 struct ImageGrabberImpl;
194 ImageGrabberImpl* impl_;
202 using Ptr = shared_ptr<ImageGrabber>;
206 float frames_per_second = 0,
208 bool pclzf_mode =
false);
211 const std::string& rgb_dir,
212 float frames_per_second = 0,
213 bool repeat =
false);
215 ImageGrabber (
const std::vector<std::string>& depth_image_files,
216 float frames_per_second = 0,
217 bool repeat =
false);
224 operator[] (std::
size_t idx) const override;
228 size () const override;
233 const
Eigen::Vector4f& origin,
234 const
Eigen::Quaternionf& orientation) const override;
239 template<typename PointT>
241 float frames_per_second,
250 template<
typename Po
intT>
252 const std::string& rgb_dir,
253 float frames_per_second,
261 template<
typename Po
intT>
263 float frames_per_second,
275 Eigen::Vector4f origin;
276 Eigen::Quaternionf orientation;
286 template <
typename Po
intT> std::size_t
293 template<
typename Po
intT>
void
FileGrabber provides a container-style interface for grabbers which operate on fixed-size input.
boost::signals2::signal< T > * createSignal()
Grabber()=default
Default ctor.
std::string getDepthFileNameAtIndex(std::size_t idx) const
Get the depth filename at a particular index.
bool isRunning() const override
whether the grabber is started (publishing) or not.
bool atLastFrame() const
Returns if the last frame is reached.
virtual void setCameraIntrinsics(const double focal_length_x, const double focal_length_y, const double principal_point_x, const double principal_point_y)
Define custom focal length and center pixel.
~ImageGrabberBase() noexcept override
Virtual destructor.
bool getTimestampAtIndex(std::size_t idx, std::uint64_t ×tamp) const
Query only the timestamp of an index, if it exists.
void setDepthImageUnits(float units)
Define the units the depth data is stored in.
ImageGrabberBase(const std::string &depth_directory, const std::string &rgb_directory, float frames_per_second, bool repeat)
void setNumberOfThreads(unsigned int nr_threads=0)
Set the number of threads, if we wish to use OpenMP for quicker cloud population.
bool getCloudAt(std::size_t idx, pcl::PCLPointCloud2 &blob, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation) const
Gets the cloud in ROS form at location idx.
std::size_t numFrames() const
Convenience function to see how many frames this consists of.
virtual void rewind()
Rewinds to the first PCD file in the list.
virtual void getCameraIntrinsics(double &focal_length_x, double &focal_length_y, double &principal_point_x, double &principal_point_y) const
Get the current focal length and center pixel.
ImageGrabberBase(const std::vector< std::string > &depth_image_files, float frames_per_second, bool repeat)
Constructor taking a list of paths to PCD files, that are played in the order they appear in the list...
std::string getCurrentDepthFileName() const
Returns the filename of the current indexed file.
void start() override
Starts playing the list of PCD files if frames_per_second is > 0.
bool isRepeatOn() const
Returns whether the repeat flag is on.
std::string getName() const override
std::string getPrevDepthFileName() const
Returns the filename of the previous indexed file SDM: adding this back in, but is this useful,...
virtual void trigger()
Triggers a callback with new data.
float getFramesPerSecond() const override
Returns the frames_per_second.
ImageGrabberBase(const std::string &directory, float frames_per_second, bool repeat, bool pclzf_mode)
Constructor taking a folder of depth+[rgb] images.
void stop() override
Stops playing the list of PCD files if frames_per_second is > 0.
void setRGBImageFiles(const std::vector< std::string > &rgb_image_files)
Manually set RGB image files.
ImageGrabber(const std::string &dir, float frames_per_second=0, bool repeat=false, bool pclzf_mode=false)
std::size_t size() const override
size Returns the number of clouds currently loaded by the grabber
void publish(const pcl::PCLPointCloud2 &blob, const Eigen::Vector4f &origin, const Eigen::Quaternionf &orientation) const override
shared_ptr< ImageGrabber > Ptr
const pcl::PointCloud< PointT >::ConstPtr operator[](std::size_t idx) const override
operator[] Returns the idx-th cloud in the dataset, without bounds checking.
boost::signals2::signal< void(const typename pcl::PointCloud< PointT >::ConstPtr &)> * signal_
~ImageGrabber() noexcept override=default
Empty destructor.
shared_ptr< const ImageGrabber > ConstPtr
PointCloud represents the base class in PCL for storing collections of 3D points.
Eigen::Quaternionf sensor_orientation_
Sensor acquisition pose (rotation).
Eigen::Vector4f sensor_origin_
Sensor acquisition pose (origin/translation).
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
Defines functions, macros and traits for allocating and using memory.
void fromPCLPointCloud2(const pcl::PCLPointCloud2 &msg, pcl::PointCloud< PointT > &cloud, const MsgFieldMap &field_map, const std::uint8_t *msg_data)
Convert a PCLPointCloud2 binary data blob into a pcl::PointCloud<T> object using a field_map.