41 #pragma GCC system_header
45 #include <pcl/pcl_macros.h>
46 #include <pcl/point_cloud.h>
47 #include <pcl/PCLPointCloud2.h>
48 #include <pcl/visualization/common/common.h>
50 #include <vtkSmartPointer.h>
51 #include <vtkDataArray.h>
52 #include <vtkFloatArray.h>
53 #include <vtkUnsignedCharArray.h>
57 namespace visualization
64 template <
typename Po
intT>
72 using Ptr = shared_ptr<PointCloudColorHandler<PointT> >;
73 using ConstPtr = shared_ptr<const PointCloudColorHandler<PointT> >;
137 template <
typename Po
intT>
145 using Ptr = shared_ptr<PointCloudColorHandlerRandom<PointT> >;
146 using ConstPtr = shared_ptr<const PointCloudColorHandlerRandom<PointT> >;
164 getName ()
const {
return (
"PointCloudColorHandlerRandom"); }
185 template <
typename Po
intT>
193 using Ptr = shared_ptr<PointCloudColorHandlerCustom<PointT> >;
194 using ConstPtr = shared_ptr<const PointCloudColorHandlerCustom<PointT> >;
208 double r,
double g,
double b)
219 getName ()
const {
return (
"PointCloudColorHandlerCustom"); }
243 template <
typename Po
intT>
251 using Ptr = shared_ptr<PointCloudColorHandlerRGBField<PointT> >;
252 using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBField<PointT> >;
283 getName ()
const {
return (
"PointCloudColorHandlerRGBField"); }
298 template <
typename Po
intT>
306 using Ptr = shared_ptr<PointCloudColorHandlerHSVField<PointT> >;
307 using ConstPtr = shared_ptr<const PointCloudColorHandlerHSVField<PointT> >;
322 getName ()
const {
return (
"PointCloudColorHandlerHSVField"); }
343 template <
typename Po
intT>
351 using Ptr = shared_ptr<PointCloudColorHandlerGenericField<PointT> >;
352 using ConstPtr = shared_ptr<const PointCloudColorHandlerGenericField<PointT> >;
356 : field_name_ (field_name)
363 const std::string &field_name)
365 , field_name_ (field_name)
385 getName ()
const {
return (
"PointCloudColorHandlerGenericField"); }
394 std::string field_name_;
404 template <
typename Po
intT>
412 using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointT> >;
413 using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointT> >;
444 getName ()
const {
return (
"PointCloudColorHandlerRGBAField"); }
460 template <
typename Po
intT>
468 using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointT> >;
469 using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointT> >;
477 static_mapping_ = static_mapping;
483 const bool static_mapping =
true)
487 static_mapping_ = static_mapping;
508 getName ()
const {
return (
"PointCloudColorHandlerLabelField"); }
516 bool static_mapping_;
532 using Ptr = shared_ptr<PointCloudColorHandler<PointCloud> >;
533 using ConstPtr = shared_ptr<const PointCloudColorHandler<PointCloud> >;
537 cloud_ (cloud), capable_ (false), field_idx_ ()
549 getName ()
const = 0;
553 getFieldName ()
const = 0;
562 getColor()
const = 0;
599 using Ptr = shared_ptr<PointCloudColorHandlerRandom<PointCloud> >;
600 using ConstPtr = shared_ptr<const PointCloudColorHandlerRandom<PointCloud> >;
611 getName ()
const {
return (
"PointCloudColorHandlerRandom"); }
618 getColor ()
const override;
637 double r,
double g,
double b) :
639 r_ (r), g_ (g), b_ (b)
646 getName ()
const {
return (
"PointCloudColorHandlerCustom"); }
653 getColor ()
const override;
674 using Ptr = shared_ptr<PointCloudColorHandlerRGBField<PointCloud> >;
675 using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBField<PointCloud> >;
681 getColor ()
const override;
686 getName ()
const {
return (
"PointCloudColorHandlerRGBField"); }
706 using Ptr = shared_ptr<PointCloudColorHandlerHSVField<PointCloud> >;
707 using ConstPtr = shared_ptr<const PointCloudColorHandlerHSVField<PointCloud> >;
713 getColor ()
const override;
718 getName ()
const {
return (
"PointCloudColorHandlerHSVField"); }
745 using Ptr = shared_ptr<PointCloudColorHandlerGenericField<PointCloud> >;
746 using ConstPtr = shared_ptr<const PointCloudColorHandlerGenericField<PointCloud> >;
750 const std::string &field_name);
753 getColor ()
const override;
758 getName ()
const {
return (
"PointCloudColorHandlerGenericField"); }
766 std::string field_name_;
783 using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointCloud> >;
784 using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointCloud> >;
790 getColor ()
const override;
795 getName ()
const {
return (
"PointCloudColorHandlerRGBAField"); }
816 using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointCloud> >;
817 using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointCloud> >;
822 const bool static_mapping =
true);
825 getColor ()
const override;
830 getName ()
const {
return (
"PointCloudColorHandlerLabelField"); }
836 bool static_mapping_;
842 #include <pcl/visualization/impl/point_cloud_color_handlers.hpp>
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
PointCloudConstPtr cloud_
A pointer to the input dataset.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getName() const
Class getName method.
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.
PointCloudColorHandlerRandom()
Constructor.
shared_ptr< PointCloud< PointT > > Ptr
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
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.
PointCloud::Ptr PointCloudPtr
virtual std::string getFieldName() const
Get the name of the field used.
shared_ptr< const PointCloudColorHandler< PointCloud > > ConstPtr
PointCloud::ConstPtr PointCloudConstPtr
virtual vtkSmartPointer< vtkDataArray > getColor() const =0
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getName() const =0
Abstract getName method.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerCustom(const PointCloudConstPtr &cloud, double r, double g, double b)
Constructor.
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 std::string getFieldName() const
Get the name of the field used.
virtual std::string getFieldName() const =0
Abstract getFieldName method.
PointCloudColorHandlerLabelField(const PointCloudConstPtr &cloud, const bool static_mapping=true)
Constructor.
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.
PointCloudColorHandler(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Abstract getName method.
Base Handler class for PointCloud colors.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
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.
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.
virtual ~PointCloudColorHandler()=default
Destructor.
HSV handler class for colors.
shared_ptr< const PointCloudColorHandler< PointT > > ConstPtr
virtual std::string getName() const
Class getName method.
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.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getFieldName() const
Get the name of the field used.
Handler for predefined user colors.
PointCloudColorHandlerRandom(const PointCloudConstPtr &cloud)
Constructor.
RGB handler class for colors.
PointCloudColorHandler()
Constructor.
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.
typename PointCloud::Ptr PointCloudPtr
typename PointCloud::ConstPtr PointCloudConstPtr
virtual std::string getName() const
Abstract getName method.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
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.
PointCloudColorHandlerRGBAField(const PointCloudConstPtr &cloud)
Constructor.
int field_idx_
The index of the field holding the data that represents the color.
PointCloudConstPtr cloud_
A pointer to the input dataset.
virtual std::string getName() const
Get the name of the class.
shared_ptr< const PointCloud< PointT > > ConstPtr
virtual std::string getFieldName() const
Get the name of the field used.
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.
shared_ptr< PointCloudColorHandler< PointCloud > > Ptr
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.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
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.
PointCloudColorHandlerRGBAField()
Constructor.
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.
PointCloudColorHandlerCustom(const PointCloudConstPtr &cloud, double r, double g, double b)
Constructor.
shared_ptr< PointCloudColorHandler< PointT > > Ptr