Point Cloud Library (PCL)  1.15.1-dev
point_cloud_color_handlers.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2012-, Open Perception, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the copyright holder(s) nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #pragma once
39 
40 #if defined __GNUC__
41 #pragma GCC system_header
42 #endif
43 
44 // PCL includes
45 #include <pcl/pcl_macros.h>
46 #include <pcl/point_cloud.h>
47 #include <pcl/PCLPointCloud2.h> // for PCLPointCloud2
48 #include <pcl/visualization/common/common.h>
49 // VTK includes
50 #include <vtkSmartPointer.h>
51 #include <vtkDataArray.h>
52 #include <vtkFloatArray.h>
53 #include <vtkUnsignedCharArray.h>
54 
55 namespace pcl
56 {
57  namespace visualization
58  {
59  //////////////////////////////////////////////////////////////////////////////////////
60  /** \brief Base Handler class for PointCloud colors.
61  * \author Radu B. Rusu
62  * \ingroup visualization
63  */
64  template <typename PointT>
66  {
67  public:
69  using PointCloudPtr = typename PointCloud::Ptr;
71 
72  using Ptr = shared_ptr<PointCloudColorHandler<PointT> >;
73  using ConstPtr = shared_ptr<const PointCloudColorHandler<PointT> >;
74 
75  /** \brief Constructor. */
77  cloud_ (), capable_ (false), field_idx_ (-1), fields_ ()
78  {}
79 
80  /** \brief Constructor. */
82  cloud_ (cloud), capable_ (false), field_idx_ (-1), fields_ ()
83  {}
84 
85  /** \brief Destructor. */
86  virtual ~PointCloudColorHandler() = default;
87 
88  /** \brief Check if this handler is capable of handling the input data or not. */
89  inline bool
90  isCapable () const { return (capable_); }
91 
92  /** \brief Abstract getName method. */
93  virtual std::string
94  getName () const = 0;
95 
96  /** \brief Abstract getFieldName method. */
97  virtual std::string
98  getFieldName () const = 0;
99 
100  /** Obtain the actual color for the input dataset as a VTK data array.
101  * Deriving handlers should override this method.
102  * \return smart pointer to VTK array if the operation was successful (the
103  * handler is capable and the input cloud was given), a null pointer otherwise */
105  getColor () const = 0;
106 
107  /** \brief Set the input cloud to be used.
108  * \param[in] cloud the input cloud to be used by the handler
109  */
110  virtual void
112  {
113  cloud_ = cloud;
114  }
115 
116  protected:
117  /** \brief A pointer to the input dataset. */
119 
120  /** \brief True if this handler is capable of handling the input data, false
121  * otherwise.
122  */
123  bool capable_;
124 
125  /** \brief The index of the field holding the data that represents the color. */
127 
128  /** \brief The list of fields available for this PointCloud. */
129  std::vector<pcl::PCLPointField> fields_;
130  };
131 
132  //////////////////////////////////////////////////////////////////////////////////////
133  /** \brief Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen)
134  * \author Radu B. Rusu
135  * \ingroup visualization
136  */
137  template <typename PointT>
139  {
141  using PointCloudPtr = typename PointCloud::Ptr;
142  using PointCloudConstPtr = typename PointCloud::ConstPtr;
143 
144  public:
145  using Ptr = shared_ptr<PointCloudColorHandlerRandom<PointT> >;
146  using ConstPtr = shared_ptr<const PointCloudColorHandlerRandom<PointT> >;
147 
148  /** \brief Constructor. */
151  {
152  capable_ = true;
153  }
154 
155  /** \brief Constructor. */
158  {
159  capable_ = true;
160  }
161 
162  /** \brief Abstract getName method. */
163  virtual std::string
164  getName () const { return ("PointCloudColorHandlerRandom"); }
165 
166  /** \brief Get the name of the field used. */
167  virtual std::string
168  getFieldName () const { return ("[random]"); }
169 
171  getColor () const override;
172 
173  protected:
174  // Members derived from the base class
177  };
178 
179  //////////////////////////////////////////////////////////////////////////////////////
180  /** \brief Handler for predefined user colors. The color at each point will be drawn
181  * as the use given R, G, B values.
182  * \author Radu B. Rusu
183  * \ingroup visualization
184  */
185  template <typename PointT>
187  {
189  using PointCloudPtr = typename PointCloud::Ptr;
190  using PointCloudConstPtr = typename PointCloud::ConstPtr;
191 
192  public:
193  using Ptr = shared_ptr<PointCloudColorHandlerCustom<PointT> >;
194  using ConstPtr = shared_ptr<const PointCloudColorHandlerCustom<PointT> >;
195 
196  /** \brief Constructor. */
197  PointCloudColorHandlerCustom (double r, double g, double b)
199  , r_ (r)
200  , g_ (g)
201  , b_ (b)
202  {
203  capable_ = true;
204  }
205 
206  /** \brief Constructor. */
208  double r, double g, double b)
209  : PointCloudColorHandler<PointT> (cloud)
210  , r_ (r)
211  , g_ (g)
212  , b_ (b)
213  {
214  capable_ = true;
215  }
216 
217  /** \brief Abstract getName method. */
218  virtual std::string
219  getName () const { return ("PointCloudColorHandlerCustom"); }
220 
221  /** \brief Get the name of the field used. */
222  virtual std::string
223  getFieldName () const { return (""); }
224 
226  getColor () const override;
227 
228  protected:
229  // Members derived from the base class
232 
233  /** \brief Internal R, G, B holding the values given by the user. */
234  double r_, g_, b_;
235  };
236 
237  //////////////////////////////////////////////////////////////////////////////////////
238  /** \brief RGB handler class for colors. Uses the data present in the "rgb" or "rgba"
239  * fields as the color at each point.
240  * \author Radu B. Rusu
241  * \ingroup visualization
242  */
243  template <typename PointT>
245  {
247  using PointCloudPtr = typename PointCloud::Ptr;
248  using PointCloudConstPtr = typename PointCloud::ConstPtr;
249 
250  public:
251  using Ptr = shared_ptr<PointCloudColorHandlerRGBField<PointT> >;
252  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBField<PointT> >;
253 
254  /** \brief Constructor. */
256  {
257  capable_ = false;
258  }
259 
260  /** \brief Constructor. */
262  : PointCloudColorHandler<PointT> (cloud)
263  {
264  setInputCloud (cloud);
265  }
266 
267  /** \brief Get the name of the field used. */
268  virtual std::string
269  getFieldName () const { return ("rgb"); }
270 
272  getColor () const override;
273 
274  /** \brief Set the input cloud to be used.
275  * \param[in] cloud the input cloud to be used by the handler
276  */
277  virtual void
278  setInputCloud (const PointCloudConstPtr &cloud);
279 
280  protected:
281  /** \brief Class getName method. */
282  virtual std::string
283  getName () const { return ("PointCloudColorHandlerRGBField"); }
284 
285  private:
286  // Members derived from the base class
291  };
292 
293  //////////////////////////////////////////////////////////////////////////////////////
294  /** \brief HSV handler class for colors. Uses the data present in the "h", "s", "v"
295  * fields as the color at each point.
296  * \ingroup visualization
297  */
298  template <typename PointT>
300  {
302  using PointCloudPtr = typename PointCloud::Ptr;
303  using PointCloudConstPtr = typename PointCloud::ConstPtr;
304 
305  public:
306  using Ptr = shared_ptr<PointCloudColorHandlerHSVField<PointT> >;
307  using ConstPtr = shared_ptr<const PointCloudColorHandlerHSVField<PointT> >;
308 
309  /** \brief Constructor. */
311 
312  /** \brief Get the name of the field used. */
313  virtual std::string
314  getFieldName () const { return ("hsv"); }
315 
317  getColor () const override;
318 
319  protected:
320  /** \brief Class getName method. */
321  virtual std::string
322  getName () const { return ("PointCloudColorHandlerHSVField"); }
323 
324  /** \brief The field index for "S". */
326 
327  /** \brief The field index for "V". */
329  private:
330  // Members derived from the base class
335  };
336 
337  //////////////////////////////////////////////////////////////////////////////////////
338  /** \brief Generic field handler class for colors. Uses an user given field to extract
339  * 1D data and display the color at each point.
340  * \ingroup visualization
341  */
342  template <typename PointT>
345  using PointCloudPtr = typename PointCloud::Ptr;
346  using PointCloudConstPtr = typename PointCloud::ConstPtr;
347 
348  /** \brief Name of the field used to create the color handler. */
349  std::string field_name_;
350 
351  public:
352  using Ptr = std::shared_ptr<PointCloudColorHandlerGenericField<PointT>>;
353  using ConstPtr = std::shared_ptr<const PointCloudColorHandlerGenericField<PointT>>;
354 
355  /** \brief constructor */
357  const std::string& field_name);
358 
359  PointCloudColorHandlerGenericField(const std::string& field_name);
360 
361  /** \brief Set the input cloud to be used.
362  * \param[in] cloud the input cloud to be used by the handler
363  */
364  void setInputCloud(const PointCloudConstPtr& cloud);
365 
366  vtkSmartPointer<vtkDataArray> getColor() const override;
367 
368  /** \brief Get the name of the field used. */
369  std::string getFieldName() const override;
370 
371  protected:
372 
373  std::vector<pcl::PCLPointField> fields_;
374 
375  /** \brief Class getName method. */
376  std::string getName() const override
377  {
378  return ("PointCloudColorHandlerGenericField");
379  }
380  };
381 
382 
383  //////////////////////////////////////////////////////////////////////////////////////
384  /** \brief RGBA handler class for colors. Uses the data present in the "rgba" field as
385  * the color at each point. Transparency is handled.
386  * \author Nizar Sallem
387  * \ingroup visualization
388  */
389  template <typename PointT>
391  {
393  using PointCloudPtr = typename PointCloud::Ptr;
394  using PointCloudConstPtr = typename PointCloud::ConstPtr;
395 
396  public:
397  using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointT> >;
398  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointT> >;
399 
400  /** \brief Constructor. */
402  {
403  capable_ = false;
404  }
405 
406  /** \brief Constructor. */
408  : PointCloudColorHandler<PointT> (cloud)
409  {
410  setInputCloud (cloud);
411  }
412 
413  /** \brief Get the name of the field used. */
414  virtual std::string
415  getFieldName () const { return ("rgba"); }
416 
418  getColor () const override;
419 
420  /** \brief Set the input cloud to be used.
421  * \param[in] cloud the input cloud to be used by the handler
422  */
423  virtual void
424  setInputCloud (const PointCloudConstPtr &cloud);
425 
426  protected:
427  /** \brief Class getName method. */
428  virtual std::string
429  getName () const { return ("PointCloudColorHandlerRGBAField"); }
430 
431  private:
432  // Members derived from the base class
437  };
438 
439  //////////////////////////////////////////////////////////////////////////////////////
440  /** \brief Label field handler class for colors. Paints the points according to their
441  * labels, assigning a unique color from a predefined color lookup table to each label.
442  * \author Sergey Alexandrov
443  * \ingroup visualization
444  */
445  template <typename PointT>
447  {
449  using PointCloudPtr = typename PointCloud::Ptr;
450  using PointCloudConstPtr = typename PointCloud::ConstPtr;
451 
452  public:
453  using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointT> >;
454  using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointT> >;
455 
456  /** \brief Constructor.
457  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
458  PointCloudColorHandlerLabelField (const bool static_mapping = true)
460  {
461  capable_ = false;
462  static_mapping_ = static_mapping;
463  }
464 
465  /** \brief Constructor.
466  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
468  const bool static_mapping = true)
469  : PointCloudColorHandler<PointT> (cloud)
470  {
471  setInputCloud (cloud);
472  static_mapping_ = static_mapping;
473  }
474 
475  /** \brief Get the name of the field used. */
476  virtual std::string
477  getFieldName () const { return ("label"); }
478 
480  getColor () const override;
481 
483 
484  /** \brief Set the input cloud to be used.
485  * \param[in] cloud the input cloud to be used by the handler
486  */
487  virtual void
488  setInputCloud (const PointCloudConstPtr &cloud);
489 
490  protected:
491  /** \brief Class getName method. */
492  virtual std::string
493  getName () const { return ("PointCloudColorHandlerLabelField"); }
494 
495  private:
496  // Members derived from the base class
501  bool static_mapping_;
502  };
503 
504  //////////////////////////////////////////////////////////////////////////////////////
505  /** \brief Base Handler class for PointCloud colors.
506  * \author Radu B. Rusu
507  * \ingroup visualization
508  */
509  template <>
511  {
512  public:
516 
517  using Ptr = shared_ptr<PointCloudColorHandler<PointCloud> >;
518  using ConstPtr = shared_ptr<const PointCloudColorHandler<PointCloud> >;
519 
520  /** \brief Constructor. */
522  cloud_ (cloud), capable_ (false), field_idx_ ()
523  {}
524 
525  /** \brief Destructor. */
526  virtual ~PointCloudColorHandler() = default;
527 
528  /** \brief Return whether this handler is capable of handling the input data or not. */
529  inline bool
530  isCapable () const { return (capable_); }
531 
532  /** \brief Abstract getName method. */
533  virtual std::string
534  getName () const = 0;
535 
536  /** \brief Abstract getFieldName method. */
537  virtual std::string
538  getFieldName () const = 0;
539 
540  /** Obtain the actual color for the input dataset as a VTK data array.
541  * Deriving handlers should override this method. The default implementation is
542  * provided only for backwards compatibility with handlers that were written
543  * before PCL 1.10.0 and will be removed in future.
544  * \return smart pointer to VTK array if the operation was successful (the
545  * handler is capable and the input cloud was given), a null pointer otherwise */
547  getColor() const = 0;
548 
549  /** \brief Set the input cloud to be used.
550  * \param[in] cloud the input cloud to be used by the handler
551  */
552  void
554  {
555  cloud_ = cloud;
556  }
557 
558  protected:
559  /** \brief A pointer to the input dataset. */
561 
562  /** \brief True if this handler is capable of handling the input data, false
563  * otherwise.
564  */
565  bool capable_;
566 
567  /** \brief The index of the field holding the data that represents the color. */
569  };
570 
571  //////////////////////////////////////////////////////////////////////////////////////
572  /** \brief Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen)
573  * \author Radu B. Rusu
574  * \ingroup visualization
575  */
576  template <>
578  {
582 
583  public:
584  using Ptr = shared_ptr<PointCloudColorHandlerRandom<PointCloud> >;
585  using ConstPtr = shared_ptr<const PointCloudColorHandlerRandom<PointCloud> >;
586 
587  /** \brief Constructor. */
590  {
591  capable_ = true;
592  }
593 
594  /** \brief Get the name of the class. */
595  virtual std::string
596  getName () const { return ("PointCloudColorHandlerRandom"); }
597 
598  /** \brief Get the name of the field used. */
599  virtual std::string
600  getFieldName () const { return ("[random]"); }
601 
603  getColor () const override;
604  };
605 
606  //////////////////////////////////////////////////////////////////////////////////////
607  /** \brief Handler for predefined user colors. The color at each point will be drawn
608  * as the use given R, G, B values.
609  * \author Radu B. Rusu
610  * \ingroup visualization
611  */
612  template <>
614  {
618 
619  public:
620  /** \brief Constructor. */
622  double r, double g, double b) :
624  r_ (r), g_ (g), b_ (b)
625  {
626  capable_ = true;
627  }
628 
629  /** \brief Get the name of the class. */
630  virtual std::string
631  getName () const { return ("PointCloudColorHandlerCustom"); }
632 
633  /** \brief Get the name of the field used. */
634  virtual std::string
635  getFieldName () const { return (""); }
636 
638  getColor () const override;
639 
640  protected:
641  /** \brief Internal R, G, B holding the values given by the user. */
642  double r_, g_, b_;
643  };
644 
645  //////////////////////////////////////////////////////////////////////////////////////
646  /** \brief RGB handler class for colors. Uses the data present in the "rgb" or "rgba"
647  * fields as the color at each point.
648  * \author Radu B. Rusu
649  * \ingroup visualization
650  */
651  template <>
653  {
657 
658  public:
659  using Ptr = shared_ptr<PointCloudColorHandlerRGBField<PointCloud> >;
660  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBField<PointCloud> >;
661 
662  /** \brief Constructor. */
664 
666  getColor () const override;
667 
668  protected:
669  /** \brief Get the name of the class. */
670  virtual std::string
671  getName () const { return ("PointCloudColorHandlerRGBField"); }
672 
673  /** \brief Get the name of the field used. */
674  virtual std::string
675  getFieldName () const { return ("rgb"); }
676  };
677 
678  //////////////////////////////////////////////////////////////////////////////////////
679  /** \brief HSV handler class for colors. Uses the data present in the "h", "s", "v"
680  * fields as the color at each point.
681  * \ingroup visualization
682  */
683  template <>
685  {
689 
690  public:
691  using Ptr = shared_ptr<PointCloudColorHandlerHSVField<PointCloud> >;
692  using ConstPtr = shared_ptr<const PointCloudColorHandlerHSVField<PointCloud> >;
693 
694  /** \brief Constructor. */
696 
698  getColor () const override;
699 
700  protected:
701  /** \brief Get the name of the class. */
702  virtual std::string
703  getName () const { return ("PointCloudColorHandlerHSVField"); }
704 
705  /** \brief Get the name of the field used. */
706  virtual std::string
707  getFieldName () const { return ("hsv"); }
708 
709  /** \brief The field index for "S". */
711 
712  /** \brief The field index for "V". */
714  };
715 
716  //////////////////////////////////////////////////////////////////////////////////////
717  /** \brief RGBA handler class for colors. Uses the data present in the "rgba" field as
718  * the color at each point. Transparency is handled.
719  * \author Nizar Sallem
720  * \ingroup visualization
721  */
722  template <>
724  {
728 
729  public:
730  using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointCloud> >;
731  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointCloud> >;
732 
733  /** \brief Constructor. */
735 
737  getColor () const override;
738 
739  protected:
740  /** \brief Get the name of the class. */
741  virtual std::string
742  getName () const { return ("PointCloudColorHandlerRGBAField"); }
743 
744  /** \brief Get the name of the field used. */
745  virtual std::string
746  getFieldName () const { return ("rgba"); }
747  };
748 
749  //////////////////////////////////////////////////////////////////////////////////////
750  /** \brief Label field handler class for colors. Paints the points according to their
751  * labels, assigning a unique color from a predefined color lookup table to each label.
752  * \author Sergey Alexandrov
753  * \ingroup visualization
754  */
755  template <>
757  {
761 
762  public:
763  using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointCloud> >;
764  using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointCloud> >;
765 
766  /** \brief Constructor.
767  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
769  const bool static_mapping = true);
770 
772  getColor () const override;
773 
774  protected:
775  /** \brief Get the name of the class. */
776  virtual std::string
777  getName () const { return ("PointCloudColorHandlerLabelField"); }
778 
779  /** \brief Get the name of the field used. */
780  virtual std::string
781  getFieldName () const { return ("label"); }
782  private:
783  bool static_mapping_;
784  };
785 
786  }
787 }
788 
789 #include <pcl/visualization/impl/point_cloud_color_handlers.hpp>
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:174
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:414
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:415
int field_idx_
The index of the field holding the data that represents the color.
bool isCapable() const
Return whether this handler is capable of handling the input data or not.
virtual std::string getFieldName() const =0
Abstract getFieldName method.
void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
shared_ptr< const PointCloudColorHandler< PointCloud > > ConstPtr
virtual std::string getName() const =0
Abstract getName method.
virtual vtkSmartPointer< vtkDataArray > getColor() const =0
Obtain the actual color for the input dataset as a VTK data array.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
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.
PointCloudColorHandlerCustom(const PointCloudConstPtr &cloud, double r, double g, double b)
Constructor.
virtual std::string getFieldName() const
Get the name of the field used.
double r_
Internal R, G, B holding the values given by the user.
PointCloudColorHandlerCustom(const PointCloudConstPtr &cloud, double r, double g, double b)
Constructor.
PointCloudColorHandlerCustom(double r, double g, double b)
Constructor.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getName() const
Abstract getName method.
std::string getName() const override
Class getName method.
PointCloudColorHandlerGenericField(const PointCloudConstPtr &cloud, const std::string &field_name)
constructor
std::string getFieldName() const override
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.
void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerHSVField(const PointCloudConstPtr &cloud)
Constructor.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
PointCloudColorHandlerHSVField(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
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.
Base Handler class for PointCloud colors.
shared_ptr< const PointCloudColorHandler< PointT > > ConstPtr
virtual ~PointCloudColorHandler()=default
Destructor.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
PointCloudConstPtr cloud_
A pointer to the input dataset.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
virtual std::string getName() const =0
Abstract getName method.
virtual vtkSmartPointer< vtkDataArray > getColor() const =0
Obtain the actual color for the input dataset as a VTK data array.
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
PointCloudColorHandler(const PointCloudConstPtr &cloud)
Constructor.
shared_ptr< PointCloudColorHandler< PointT > > Ptr
virtual std::string getFieldName() const =0
Abstract getFieldName method.
int field_idx_
The index of the field holding the data that represents the color.
PointCloudColorHandlerLabelField(const PointCloudConstPtr &cloud, const bool static_mapping=true)
Constructor.
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 void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
virtual std::string getName() const
Class getName method.
PointCloudColorHandlerLabelField(const PointCloudConstPtr &cloud, const bool static_mapping=true)
Constructor.
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.
PointCloudColorHandlerLabelField(const bool static_mapping=true)
Constructor.
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.
PointCloudColorHandlerRGBAField(const PointCloudConstPtr &cloud)
Constructor.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
PointCloudColorHandlerRGBAField(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerRGBField(const PointCloudConstPtr &cloud)
Constructor.
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.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerRGBField(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be 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 random PointCloud colors (i.e., R, G, B will be randomly chosen)
virtual std::string getName() const
Abstract getName method.
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.
PointCloudColorHandlerRandom(const PointCloudConstPtr &cloud)
Constructor.
Defines all the PCL and non-PCL macros used.
#define PCL_EXPORTS
Definition: pcl_macros.h:324
A point structure representing Euclidean xyz coordinates, and the RGB color.