37 #ifndef PCL_POINT_CLOUD_COLOR_HANDLERS_H_
38 #define PCL_POINT_CLOUD_COLOR_HANDLERS_H_
41 #pragma GCC system_header
45 #include <pcl/point_cloud.h>
46 #include <pcl/common/io.h>
47 #include <pcl/visualization/common/common.h>
49 #include <vtkSmartPointer.h>
50 #include <vtkDataArray.h>
51 #include <vtkFloatArray.h>
52 #include <vtkUnsignedCharArray.h>
56 namespace visualization
63 template <
typename Po
intT>
71 typedef boost::shared_ptr<PointCloudColorHandler<PointT> >
Ptr;
72 typedef boost::shared_ptr<const PointCloudColorHandler<PointT> >
ConstPtr;
137 template <
typename Po
intT>
145 typedef boost::shared_ptr<PointCloudColorHandlerRandom<PointT> >
Ptr;
146 typedef boost::shared_ptr<const PointCloudColorHandlerRandom<PointT> >
ConstPtr;
164 getName ()
const {
return (
"PointCloudColorHandlerRandom"); }
190 template <
typename Po
intT>
198 typedef boost::shared_ptr<PointCloudColorHandlerCustom<PointT> >
Ptr;
199 typedef boost::shared_ptr<const PointCloudColorHandlerCustom<PointT> >
ConstPtr;
213 double r,
double g,
double b)
227 getName ()
const {
return (
"PointCloudColorHandlerCustom"); }
256 template <
typename Po
intT>
264 typedef boost::shared_ptr<PointCloudColorHandlerRGBField<PointT> >
Ptr;
265 typedef boost::shared_ptr<const PointCloudColorHandlerRGBField<PointT> >
ConstPtr;
304 getName ()
const {
return (
"PointCloudColorHandlerRGBField"); }
319 template <
typename Po
intT>
327 typedef boost::shared_ptr<PointCloudColorHandlerHSVField<PointT> >
Ptr;
328 typedef boost::shared_ptr<const PointCloudColorHandlerHSVField<PointT> >
ConstPtr;
351 getName ()
const {
return (
"PointCloudColorHandlerHSVField"); }
372 template <
typename Po
intT>
380 typedef boost::shared_ptr<PointCloudColorHandlerGenericField<PointT> >
Ptr;
381 typedef boost::shared_ptr<const PointCloudColorHandlerGenericField<PointT> >
ConstPtr;
385 : field_name_ (field_name)
392 const std::string &field_name)
394 , field_name_ (field_name)
422 getName ()
const {
return (
"PointCloudColorHandlerGenericField"); }
431 std::string field_name_;
441 template <
typename Po
intT>
449 typedef boost::shared_ptr<PointCloudColorHandlerRGBAField<PointT> >
Ptr;
450 typedef boost::shared_ptr<const PointCloudColorHandlerRGBAField<PointT> >
ConstPtr;
489 getName ()
const {
return (
"PointCloudColorHandlerRGBAField"); }
505 template <
typename Po
intT>
513 typedef boost::shared_ptr<PointCloudColorHandlerLabelField<PointT> >
Ptr;
514 typedef boost::shared_ptr<const PointCloudColorHandlerLabelField<PointT> >
ConstPtr;
522 static_mapping_ = static_mapping;
528 const bool static_mapping =
true)
532 static_mapping_ = static_mapping;
559 getName ()
const {
return (
"PointCloudColorHandlerLabelField"); }
567 bool static_mapping_;
583 typedef boost::shared_ptr<PointCloudColorHandler<PointCloud> >
Ptr;
584 typedef boost::shared_ptr<const PointCloudColorHandler<PointCloud> >
ConstPtr;
588 cloud_ (cloud), capable_ (false), field_idx_ ()
600 getName ()
const = 0;
604 getFieldName ()
const = 0;
649 typedef boost::shared_ptr<PointCloudColorHandlerRandom<PointCloud> >
Ptr;
650 typedef boost::shared_ptr<const PointCloudColorHandlerRandom<PointCloud> >
ConstPtr;
664 getName ()
const {
return (
"PointCloudColorHandlerRandom"); }
695 double r,
double g,
double b) :
697 r_ (r), g_ (g), b_ (b)
707 getName ()
const {
return (
"PointCloudColorHandlerCustom"); }
740 typedef boost::shared_ptr<PointCloudColorHandlerRGBField<PointCloud> >
Ptr;
741 typedef boost::shared_ptr<const PointCloudColorHandlerRGBField<PointCloud> >
ConstPtr;
760 getName ()
const {
return (
"PointCloudColorHandlerRGBField"); }
780 typedef boost::shared_ptr<PointCloudColorHandlerHSVField<PointCloud> >
Ptr;
781 typedef boost::shared_ptr<const PointCloudColorHandlerHSVField<PointCloud> >
ConstPtr;
800 getName ()
const {
return (
"PointCloudColorHandlerHSVField"); }
827 typedef boost::shared_ptr<PointCloudColorHandlerGenericField<PointCloud> >
Ptr;
828 typedef boost::shared_ptr<const PointCloudColorHandlerGenericField<PointCloud> >
ConstPtr;
832 const std::string &field_name);
848 getName ()
const {
return (
"PointCloudColorHandlerGenericField"); }
856 std::string field_name_;
873 typedef boost::shared_ptr<PointCloudColorHandlerRGBAField<PointCloud> >
Ptr;
874 typedef boost::shared_ptr<const PointCloudColorHandlerRGBAField<PointCloud> >
ConstPtr;
893 getName ()
const {
return (
"PointCloudColorHandlerRGBAField"); }
914 typedef boost::shared_ptr<PointCloudColorHandlerLabelField<PointCloud> >
Ptr;
915 typedef boost::shared_ptr<const PointCloudColorHandlerLabelField<PointCloud> >
ConstPtr;
920 const bool static_mapping =
true);
936 getName ()
const {
return (
"PointCloudColorHandlerLabelField"); }
942 bool static_mapping_;
948 #include <pcl/visualization/impl/point_cloud_color_handlers.hpp>
950 #endif // PCL_POINT_CLOUD_COLOR_HANDLERS_H_
PointCloudConstPtr cloud_
A pointer to the input dataset.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
virtual std::string getName() const
Class getName method.
boost::shared_ptr< PointCloud< PointT > > Ptr
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
virtual std::string getName() const
Get the name of the class.
PointCloudColorHandlerRandom(const PointCloudConstPtr &cloud)
Constructor.
boost::shared_ptr< const PointCloudColorHandlerRGBField< PointT > > ConstPtr
PointCloudColorHandlerRandom()
Constructor.
virtual ~PointCloudColorHandlerCustom()
Empty destructor.
virtual ~PointCloudColorHandlerRandom()
Empty destructor.
boost::shared_ptr< const PointCloudColorHandlerHSVField< PointCloud > > ConstPtr
virtual std::string getName() const
Get the name of the class.
Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen)
Label field handler class for colors.
boost::shared_ptr< const PointCloudColorHandlerGenericField< PointCloud > > ConstPtr
virtual ~PointCloudColorHandlerRGBField()
Destructor.
virtual std::string getFieldName() const
Get the name of the field used.
boost::shared_ptr< const PointCloudColorHandlerRandom< PointCloud > > ConstPtr
PointCloud::Ptr PointCloudPtr
PointCloud::Ptr PointCloudPtr
virtual ~PointCloudColorHandlerGenericField()
Empty destructor.
This file defines compatibility wrappers for low level I/O functions.
boost::shared_ptr< PointCloudColorHandlerLabelField< PointCloud > > Ptr
boost::shared_ptr< PointCloudColorHandlerGenericField< PointCloud > > Ptr
boost::shared_ptr< PointCloudColorHandlerGenericField< PointT > > Ptr
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerCustom(const PointCloudConstPtr &cloud, double r, double g, double b)
Constructor.
boost::shared_ptr< const PointCloudColorHandler< PointCloud > > ConstPtr
PointCloudColorHandlerLabelField(const bool static_mapping=true)
Constructor.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
PointCloudColorHandlerRGBField()
Constructor.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
virtual ~PointCloudColorHandlerRGBAField()
Destructor.
virtual std::string getFieldName() const
Get the name of the field used.
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
Obtain the actual color for the input dataset as vtk scalars.
virtual ~PointCloudColorHandlerRGBAField()
Empty destructor.
PointCloudColorHandlerLabelField(const PointCloudConstPtr &cloud, const bool static_mapping=true)
Constructor.
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
Obtain the actual color for the input dataset as vtk scalars.
boost::shared_ptr< PointCloudColorHandlerHSVField< PointCloud > > Ptr
virtual std::string getName() const
Class getName method.
PointCloudColorHandlerHSVField(const PointCloudConstPtr &cloud)
Constructor.
PointCloudColorHandlerRGBField(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getFieldName() const
Get the name of the field used.
virtual ~PointCloudColorHandlerLabelField()
Destructor.
PointCloudColorHandler(const PointCloudConstPtr &cloud)
Constructor.
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
Obtain the actual color for the input dataset as vtk scalars.
virtual ~PointCloudColorHandlerCustom()
Destructor.
virtual std::string getName() const
Abstract getName method.
boost::shared_ptr< PointCloudColorHandlerLabelField< PointT > > Ptr
boost::shared_ptr< ::pcl::PCLPointCloud2 > Ptr
Base Handler class for PointCloud colors.
PointCloud::ConstPtr PointCloudConstPtr
boost::shared_ptr< const PointCloudColorHandlerRGBAField< PointT > > ConstPtr
boost::shared_ptr< const PointCloudColorHandlerRGBAField< PointCloud > > ConstPtr
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getName() const
Get the name of the class.
int s_field_idx_
The field index for "S".
void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
PointCloudColorHandlerCustom(double r, double g, double b)
Constructor.
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
virtual ~PointCloudColorHandlerHSVField()
Empty destructor.
virtual std::string getFieldName() const
Get the name of the field used.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
PointCloudColorHandlerGenericField(const std::string &field_name)
Constructor.
boost::shared_ptr< PointCloudColorHandlerRandom< PointCloud > > Ptr
virtual ~PointCloudColorHandlerRGBField()
Empty destructor.
HSV handler class for colors.
boost::shared_ptr< PointCloudColorHandlerRGBAField< PointT > > Ptr
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
Obtain the actual color for the input dataset as vtk scalars.
boost::shared_ptr< PointCloudColorHandlerHSVField< PointT > > Ptr
virtual ~PointCloudColorHandlerLabelField()
Empty destructor.
virtual std::string getName() const
Class getName method.
boost::shared_ptr< const PointCloudColorHandlerLabelField< PointT > > ConstPtr
double r_
Internal R, G, B holding the values given by the user.
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getFieldName() const
Get the name of the field used.
Handler for predefined user colors.
boost::shared_ptr< const PointCloudColorHandlerRGBField< PointCloud > > ConstPtr
PointCloudColorHandlerRandom(const PointCloudConstPtr &cloud)
Constructor.
RGB handler class for colors.
PointCloudColorHandler()
Constructor.
boost::shared_ptr< const PointCloudColorHandlerRandom< PointT > > ConstPtr
virtual ~PointCloudColorHandlerHSVField()
Empty destructor.
int s_field_idx_
The field index for "S".
PointCloudColorHandler(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Get the name of the class.
Generic field handler class for colors.
boost::shared_ptr< ::pcl::PCLPointCloud2 const > ConstPtr
boost::shared_ptr< PointCloudColorHandlerRandom< PointT > > Ptr
virtual std::string getName() const
Abstract getName method.
virtual ~PointCloudColorHandler()
Destructor.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
pcl::PCLPointCloud2 PointCloud
boost::shared_ptr< PointCloudColorHandler< PointCloud > > Ptr
int v_field_idx_
The field index for "V".
virtual std::string getFieldName() const
Get the name of the field used.
int v_field_idx_
The field index for "V".
virtual std::string getName() const
Get the name of the class.
boost::shared_ptr< const PointCloudColorHandlerCustom< PointT > > ConstPtr
PointCloudColorHandlerRGBAField(const PointCloudConstPtr &cloud)
Constructor.
int field_idx_
The index of the field holding the data that represents the color.
boost::shared_ptr< PointCloudColorHandler< PointT > > Ptr
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
Obtain the actual color for the input dataset as vtk scalars.
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
Obtain the actual color for the input dataset as vtk scalars.
PointCloudConstPtr cloud_
A pointer to the input dataset.
virtual std::string getName() const
Get the name of the class.
boost::shared_ptr< const PointCloudColorHandler< PointT > > ConstPtr
virtual std::string getFieldName() const =0
Abstract getFieldName method.
boost::shared_ptr< const PointCloudColorHandlerGenericField< PointT > > ConstPtr
boost::shared_ptr< PointCloudColorHandlerCustom< PointT > > Ptr
virtual std::string getFieldName() const
Get the name of the field used.
boost::shared_ptr< PointCloudColorHandlerRGBField< PointT > > Ptr
virtual std::string getFieldName() const
Get the name of the field used.
bool isCapable() const
Return whether this handler is capable of handling the input data or not.
PointCloudColorHandlerGenericField(const PointCloudConstPtr &cloud, const std::string &field_name)
Constructor.
virtual std::string getName() const
Class getName method.
int field_idx_
The index of the field holding the data that represents the color.
virtual std::string getFieldName() const
Get the name of the field used.
A point structure representing Euclidean xyz coordinates, and the RGB color.
boost::shared_ptr< const PointCloudColorHandlerLabelField< PointCloud > > ConstPtr
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
boost::shared_ptr< const PointCloudColorHandlerHSVField< PointT > > ConstPtr
virtual std::string getName() const =0
Abstract getName method.
virtual std::string getName() const
Get the name of the class.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getFieldName() const
Get the name of the field used.
virtual ~PointCloudColorHandler()
Destructor.
boost::shared_ptr< PointCloudColorHandlerRGBField< PointCloud > > Ptr
PointCloudColorHandlerRGBAField()
Constructor.
PointCloud::ConstPtr PointCloudConstPtr
boost::shared_ptr< PointCloudColorHandlerRGBAField< PointCloud > > Ptr
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const =0
Obtain the actual color for the input dataset as vtk scalars.
virtual ~PointCloudColorHandlerGenericField()
Destructor.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
RGBA handler class for colors.
virtual std::string getName() const
Class getName method.
double r_
Internal R, G, B holding the values given by the user.
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
Obtain the actual color for the input dataset as vtk scalars.
pcl::PointCloud< PointT > PointCloud
PointCloudColorHandlerCustom(const PointCloudConstPtr &cloud, double r, double g, double b)
Constructor.