point_cloud_library / 1.12.1 / classpcl_1_1_image_grabber_base.html /

Base class for Image file grabber. More...

#include <pcl/io/image_grabber.h>

Public Member Functions

ImageGrabberBase (const std::string &directory, float frames_per_second, bool repeat, bool pclzf_mode)
Constructor taking a folder of depth+[rgb] images. More...
ImageGrabberBase (const std::string &depth_directory, const std::string &rgb_directory, float frames_per_second, bool repeat)
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. More...
~ImageGrabberBase () noexcept
Virtual destructor. More...
void start () override
Starts playing the list of PCD files if frames_per_second is > 0. More...
void stop () override
Stops playing the list of PCD files if frames_per_second is > 0. More...
virtual void trigger ()
Triggers a callback with new data. More...
bool isRunning () const override
whether the grabber is started (publishing) or not. More...
std::string getName () const override
virtual void rewind ()
Rewinds to the first PCD file in the list. More...
float getFramesPerSecond () const override
Returns the frames_per_second. More...
bool isRepeatOn () const
Returns whether the repeat flag is on. More...
bool atLastFrame () const
Returns if the last frame is reached. More...
std::string getCurrentDepthFileName () const
Returns the filename of the current indexed file. More...
std::string getPrevDepthFileName () const
Returns the filename of the previous indexed file SDM: adding this back in, but is this useful, or confusing? More...
std::string getDepthFileNameAtIndex (std::size_t idx) const
Get the depth filename at a particular index. More...
bool getTimestampAtIndex (std::size_t idx, std::uint64_t &timestamp) const
Query only the timestamp of an index, if it exists. More...
void setRGBImageFiles (const std::vector< std::string > &rgb_image_files)
Manually set RGB image files. More...
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. More...
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. More...
void setDepthImageUnits (float units)
Define the units the depth data is stored in. More...
void setNumberOfThreads (unsigned int nr_threads=0)
Set the number of threads, if we wish to use OpenMP for quicker cloud population. More...
- Public Member Functions inherited from pcl::Grabber
Grabber ()=default
Default ctor. More...
Grabber (const Grabber &)=delete
No copy ctor since Grabber can't be copied. More...
Grabber & operator= (const Grabber &)=delete
No copy assign operator since Grabber can't be copied. More...
Grabber (Grabber &&)=default
Move ctor. More...
Grabber & operator= (Grabber &&)=default
Move assign operator. More...
virtual ~Grabber () noexcept=default
virtual destructor. More...
template<typename T >
boost::signals2::connection registerCallback (const std::function< T > &callback)
registers a callback function/method to a signal with the corresponding signature More...
template<typename T >
bool providesCallback () const noexcept
indicates whether a signal with given parameter-type exists or not More...
bool toggle ()
For devices that are streaming, stopped streams are started and running stream are stopped. More...

Protected Member Functions

std::size_t numFrames () const
Convenience function to see how many frames this consists of. More...
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. More...
- Protected Member Functions inherited from pcl::Grabber
virtual void signalsChanged ()
template<typename T >
boost::signals2::signal< T > * find_signal () const noexcept
template<typename T >
int num_slots () const noexcept
template<typename T >
void disconnect_all_slots ()
template<typename T >
void block_signal ()
template<typename T >
void unblock_signal ()
void block_signals ()
void unblock_signals ()
template<typename T >
boost::signals2::signal< T > * createSignal ()

Additional Inherited Members

- Protected Attributes inherited from pcl::Grabber
std::map< std::string, std::unique_ptr< boost::signals2::signal_base > > signals_
std::map< std::string, std::vector< boost::signals2::connection > > connections_
std::map< std::string, std::vector< boost::signals2::shared_connection_block > > shared_connections_

Detailed Description

Base class for Image file grabber.

Definition at line 59 of file image_grabber.h.

Constructor & Destructor Documentation

ImageGrabberBase() [1/3]

pcl::ImageGrabberBase::ImageGrabberBase ( const std::string & directory,
float frames_per_second,
bool repeat,
bool pclzf_mode
)

Constructor taking a folder of depth+[rgb] images.

Parameters
[in] directory Directory which contains an ordered set of images corresponding to an [RGB]D video, stored as TIFF, PNG, JPG, or PPM files. The naming convention is: frame_[timestamp]_["depth"/"rgb"].[extension]
[in] frames_per_second frames per second. If 0, start() functions like a trigger, publishing the next PCD in the list.
[in] repeat whether to play PCD file in an endless loop or not.
pclzf_mode

ImageGrabberBase() [2/3]

pcl::ImageGrabberBase::ImageGrabberBase ( const std::string & depth_directory,
const std::string & rgb_directory,
float frames_per_second,
bool repeat
)

ImageGrabberBase() [3/3]

pcl::ImageGrabberBase::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.

Parameters
[in] depth_image_files Path to the depth image files files.
[in] frames_per_second frames per second. If 0, start() functions like a trigger, publishing the next PCD in the list.
[in] repeat whether to play PCD file in an endless loop or not.

~ImageGrabberBase()

pcl::ImageGrabberBase::~ImageGrabberBase ( )
noexcept

Virtual destructor.

Member Function Documentation

atLastFrame()

bool pcl::ImageGrabberBase::atLastFrame ( ) const

Returns if the last frame is reached.

getCameraIntrinsics()

virtual void pcl::ImageGrabberBase::getCameraIntrinsics ( double & focal_length_x,
double & focal_length_y,
double & principal_point_x,
double & principal_point_y
) const
virtual

Get the current focal length and center pixel.

If the intrinsics have been manually set with setCameraIntrinsics, this will return those values. Else, if start () has been called and the grabber has found a frame_[timestamp].xml file, this will return the most recent values read. Else, returns factory defaults.

Parameters
[out] focal_length_x Horizontal focal length (fx)
[out] focal_length_y Vertical focal length (fy)
[out] principal_point_x Horizontal coordinates of the principal point (cx)
[out] principal_point_y Vertical coordinates of the principal point (cy)

getCloudAt()

bool pcl::ImageGrabberBase::getCloudAt ( std::size_t idx,
pcl::PCLPointCloud2 & blob,
Eigen::Vector4f & origin,
Eigen::Quaternionf & orientation
) const
protected

Gets the cloud in ROS form at location idx.

getCurrentDepthFileName()

std::string pcl::ImageGrabberBase::getCurrentDepthFileName ( ) const

Returns the filename of the current indexed file.

getDepthFileNameAtIndex()

std::string pcl::ImageGrabberBase::getDepthFileNameAtIndex ( std::size_t idx ) const

Get the depth filename at a particular index.

getFramesPerSecond()

float pcl::ImageGrabberBase::getFramesPerSecond ( ) const
overridevirtual

Returns the frames_per_second.

0 if grabber is trigger-based

Implements pcl::Grabber.

getName()

std::string pcl::ImageGrabberBase::getName ( ) const
overridevirtual
Returns
The name of the grabber

Implements pcl::Grabber.

getPrevDepthFileName()

std::string pcl::ImageGrabberBase::getPrevDepthFileName ( ) const

Returns the filename of the previous indexed file SDM: adding this back in, but is this useful, or confusing?

getTimestampAtIndex()

bool pcl::ImageGrabberBase::getTimestampAtIndex ( std::size_t idx,
std::uint64_t & timestamp
) const

Query only the timestamp of an index, if it exists.

isRepeatOn()

bool pcl::ImageGrabberBase::isRepeatOn ( ) const

Returns whether the repeat flag is on.

isRunning()

bool pcl::ImageGrabberBase::isRunning ( ) const
overridevirtual

whether the grabber is started (publishing) or not.

Returns
true only if publishing.

Implements pcl::Grabber.

numFrames()

std::size_t pcl::ImageGrabberBase::numFrames ( ) const
protected

Convenience function to see how many frames this consists of.

rewind()

virtual void pcl::ImageGrabberBase::rewind ( )
virtual

Rewinds to the first PCD file in the list.

setCameraIntrinsics()

virtual void pcl::ImageGrabberBase::setCameraIntrinsics ( const double focal_length_x,
const double focal_length_y,
const double principal_point_x,
const double principal_point_y
)
virtual

Define custom focal length and center pixel.

This will override ANY other setting of parameters for the duration of the grabber's life, whether by factory defaults or explicitly read from a frame_[timestamp].xml file.

Parameters
[in] focal_length_x Horizontal focal length (fx)
[in] focal_length_y Vertical focal length (fy)
[in] principal_point_x Horizontal coordinates of the principal point (cx)
[in] principal_point_y Vertical coordinates of the principal point (cy)

setDepthImageUnits()

void pcl::ImageGrabberBase::setDepthImageUnits ( float units )

Define the units the depth data is stored in.

Defaults to mm (0.001), meaning a brightness of 1000 corresponds to 1 m

setNumberOfThreads()

void pcl::ImageGrabberBase::setNumberOfThreads ( unsigned int nr_threads = 0 )

Set the number of threads, if we wish to use OpenMP for quicker cloud population.

Note that for a standard (< 4 core) machine this is unlikely to yield a drastic speedup.

setRGBImageFiles()

void pcl::ImageGrabberBase::setRGBImageFiles ( const std::vector< std::string > & rgb_image_files )

Manually set RGB image files.

Parameters
[in] rgb_image_files A vector of [tiff/png/jpg/ppm] files to use as input. There must be a 1-to-1 correspondence between these and the depth images you set

start()

void pcl::ImageGrabberBase::start ( )
overridevirtual

Starts playing the list of PCD files if frames_per_second is > 0.

Otherwise it works as a trigger: publishes only the next PCD file in the list.

Implements pcl::Grabber.

stop()

void pcl::ImageGrabberBase::stop ( )
overridevirtual

Stops playing the list of PCD files if frames_per_second is > 0.

Otherwise the method has no effect.

Implements pcl::Grabber.

trigger()

virtual void pcl::ImageGrabberBase::trigger ( )
virtual

Triggers a callback with new data.


The documentation for this class was generated from the following file:

© 2009–2012, Willow Garage, Inc.
© 2012–, Open Perception, Inc.
Licensed under the BSD License.
https://pointclouds.org/documentation/classpcl_1_1_image_grabber_base.html