Point Cloud Library (PCL)  1.13.0-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 using a min-max lookup table.
340  * \author Radu B. Rusu
341  * \ingroup visualization
342  */
343  template <typename PointT>
345  {
347  using PointCloudPtr = typename PointCloud::Ptr;
348  using PointCloudConstPtr = typename PointCloud::ConstPtr;
349 
350  public:
351  using Ptr = shared_ptr<PointCloudColorHandlerGenericField<PointT> >;
352  using ConstPtr = shared_ptr<const PointCloudColorHandlerGenericField<PointT> >;
353 
354  /** \brief Constructor. */
355  PointCloudColorHandlerGenericField (const std::string &field_name)
356  : field_name_ (field_name)
357  {
358  capable_ = false;
359  }
360 
361  /** \brief Constructor. */
363  const std::string &field_name)
364  : PointCloudColorHandler<PointT> (cloud)
365  , field_name_ (field_name)
366  {
367  setInputCloud (cloud);
368  }
369 
370  /** \brief Get the name of the field used. */
371  virtual std::string getFieldName () const { return (field_name_); }
372 
374  getColor () const override;
375 
376  /** \brief Set the input cloud to be used.
377  * \param[in] cloud the input cloud to be used by the handler
378  */
379  virtual void
380  setInputCloud (const PointCloudConstPtr &cloud);
381 
382  protected:
383  /** \brief Class getName method. */
384  virtual std::string
385  getName () const { return ("PointCloudColorHandlerGenericField"); }
386 
387  private:
392 
393  /** \brief Name of the field used to create the color handler. */
394  std::string field_name_;
395  };
396 
397 
398  //////////////////////////////////////////////////////////////////////////////////////
399  /** \brief RGBA handler class for colors. Uses the data present in the "rgba" field as
400  * the color at each point. Transparency is handled.
401  * \author Nizar Sallem
402  * \ingroup visualization
403  */
404  template <typename PointT>
406  {
408  using PointCloudPtr = typename PointCloud::Ptr;
409  using PointCloudConstPtr = typename PointCloud::ConstPtr;
410 
411  public:
412  using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointT> >;
413  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointT> >;
414 
415  /** \brief Constructor. */
417  {
418  capable_ = false;
419  }
420 
421  /** \brief Constructor. */
423  : PointCloudColorHandler<PointT> (cloud)
424  {
425  setInputCloud (cloud);
426  }
427 
428  /** \brief Get the name of the field used. */
429  virtual std::string
430  getFieldName () const { return ("rgba"); }
431 
433  getColor () const override;
434 
435  /** \brief Set the input cloud to be used.
436  * \param[in] cloud the input cloud to be used by the handler
437  */
438  virtual void
439  setInputCloud (const PointCloudConstPtr &cloud);
440 
441  protected:
442  /** \brief Class getName method. */
443  virtual std::string
444  getName () const { return ("PointCloudColorHandlerRGBAField"); }
445 
446  private:
447  // Members derived from the base class
452  };
453 
454  //////////////////////////////////////////////////////////////////////////////////////
455  /** \brief Label field handler class for colors. Paints the points according to their
456  * labels, assigning a unique color from a predefined color lookup table to each label.
457  * \author Sergey Alexandrov
458  * \ingroup visualization
459  */
460  template <typename PointT>
462  {
464  using PointCloudPtr = typename PointCloud::Ptr;
465  using PointCloudConstPtr = typename PointCloud::ConstPtr;
466 
467  public:
468  using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointT> >;
469  using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointT> >;
470 
471  /** \brief Constructor.
472  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
473  PointCloudColorHandlerLabelField (const bool static_mapping = true)
475  {
476  capable_ = false;
477  static_mapping_ = static_mapping;
478  }
479 
480  /** \brief Constructor.
481  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
483  const bool static_mapping = true)
484  : PointCloudColorHandler<PointT> (cloud)
485  {
486  setInputCloud (cloud);
487  static_mapping_ = static_mapping;
488  }
489 
490  /** \brief Get the name of the field used. */
491  virtual std::string
492  getFieldName () const { return ("label"); }
493 
495  getColor () const override;
496 
498 
499  /** \brief Set the input cloud to be used.
500  * \param[in] cloud the input cloud to be used by the handler
501  */
502  virtual void
503  setInputCloud (const PointCloudConstPtr &cloud);
504 
505  protected:
506  /** \brief Class getName method. */
507  virtual std::string
508  getName () const { return ("PointCloudColorHandlerLabelField"); }
509 
510  private:
511  // Members derived from the base class
516  bool static_mapping_;
517  };
518 
519  //////////////////////////////////////////////////////////////////////////////////////
520  /** \brief Base Handler class for PointCloud colors.
521  * \author Radu B. Rusu
522  * \ingroup visualization
523  */
524  template <>
526  {
527  public:
531 
532  using Ptr = shared_ptr<PointCloudColorHandler<PointCloud> >;
533  using ConstPtr = shared_ptr<const PointCloudColorHandler<PointCloud> >;
534 
535  /** \brief Constructor. */
537  cloud_ (cloud), capable_ (false), field_idx_ ()
538  {}
539 
540  /** \brief Destructor. */
541  virtual ~PointCloudColorHandler() = default;
542 
543  /** \brief Return whether this handler is capable of handling the input data or not. */
544  inline bool
545  isCapable () const { return (capable_); }
546 
547  /** \brief Abstract getName method. */
548  virtual std::string
549  getName () const = 0;
550 
551  /** \brief Abstract getFieldName method. */
552  virtual std::string
553  getFieldName () const = 0;
554 
555  /** Obtain the actual color for the input dataset as a VTK data array.
556  * Deriving handlers should override this method. The default implementation is
557  * provided only for backwards compatibility with handlers that were written
558  * before PCL 1.10.0 and will be removed in future.
559  * \return smart pointer to VTK array if the operation was successful (the
560  * handler is capable and the input cloud was given), a null pointer otherwise */
562  getColor() const = 0;
563 
564  /** \brief Set the input cloud to be used.
565  * \param[in] cloud the input cloud to be used by the handler
566  */
567  void
569  {
570  cloud_ = cloud;
571  }
572 
573  protected:
574  /** \brief A pointer to the input dataset. */
576 
577  /** \brief True if this handler is capable of handling the input data, false
578  * otherwise.
579  */
580  bool capable_;
581 
582  /** \brief The index of the field holding the data that represents the color. */
584  };
585 
586  //////////////////////////////////////////////////////////////////////////////////////
587  /** \brief Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen)
588  * \author Radu B. Rusu
589  * \ingroup visualization
590  */
591  template <>
593  {
597 
598  public:
599  using Ptr = shared_ptr<PointCloudColorHandlerRandom<PointCloud> >;
600  using ConstPtr = shared_ptr<const PointCloudColorHandlerRandom<PointCloud> >;
601 
602  /** \brief Constructor. */
605  {
606  capable_ = true;
607  }
608 
609  /** \brief Get the name of the class. */
610  virtual std::string
611  getName () const { return ("PointCloudColorHandlerRandom"); }
612 
613  /** \brief Get the name of the field used. */
614  virtual std::string
615  getFieldName () const { return ("[random]"); }
616 
618  getColor () const override;
619  };
620 
621  //////////////////////////////////////////////////////////////////////////////////////
622  /** \brief Handler for predefined user colors. The color at each point will be drawn
623  * as the use given R, G, B values.
624  * \author Radu B. Rusu
625  * \ingroup visualization
626  */
627  template <>
629  {
633 
634  public:
635  /** \brief Constructor. */
637  double r, double g, double b) :
639  r_ (r), g_ (g), b_ (b)
640  {
641  capable_ = true;
642  }
643 
644  /** \brief Get the name of the class. */
645  virtual std::string
646  getName () const { return ("PointCloudColorHandlerCustom"); }
647 
648  /** \brief Get the name of the field used. */
649  virtual std::string
650  getFieldName () const { return (""); }
651 
653  getColor () const override;
654 
655  protected:
656  /** \brief Internal R, G, B holding the values given by the user. */
657  double r_, g_, b_;
658  };
659 
660  //////////////////////////////////////////////////////////////////////////////////////
661  /** \brief RGB handler class for colors. Uses the data present in the "rgb" or "rgba"
662  * fields as the color at each point.
663  * \author Radu B. Rusu
664  * \ingroup visualization
665  */
666  template <>
668  {
672 
673  public:
674  using Ptr = shared_ptr<PointCloudColorHandlerRGBField<PointCloud> >;
675  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBField<PointCloud> >;
676 
677  /** \brief Constructor. */
679 
681  getColor () const override;
682 
683  protected:
684  /** \brief Get the name of the class. */
685  virtual std::string
686  getName () const { return ("PointCloudColorHandlerRGBField"); }
687 
688  /** \brief Get the name of the field used. */
689  virtual std::string
690  getFieldName () const { return ("rgb"); }
691  };
692 
693  //////////////////////////////////////////////////////////////////////////////////////
694  /** \brief HSV handler class for colors. Uses the data present in the "h", "s", "v"
695  * fields as the color at each point.
696  * \ingroup visualization
697  */
698  template <>
700  {
704 
705  public:
706  using Ptr = shared_ptr<PointCloudColorHandlerHSVField<PointCloud> >;
707  using ConstPtr = shared_ptr<const PointCloudColorHandlerHSVField<PointCloud> >;
708 
709  /** \brief Constructor. */
711 
713  getColor () const override;
714 
715  protected:
716  /** \brief Get the name of the class. */
717  virtual std::string
718  getName () const { return ("PointCloudColorHandlerHSVField"); }
719 
720  /** \brief Get the name of the field used. */
721  virtual std::string
722  getFieldName () const { return ("hsv"); }
723 
724  /** \brief The field index for "S". */
726 
727  /** \brief The field index for "V". */
729  };
730 
731  //////////////////////////////////////////////////////////////////////////////////////
732  /** \brief Generic field handler class for colors. Uses an user given field to extract
733  * 1D data and display the color at each point using a min-max lookup table.
734  * \author Radu B. Rusu
735  * \ingroup visualization
736  */
737  template <>
739  {
743 
744  public:
745  using Ptr = shared_ptr<PointCloudColorHandlerGenericField<PointCloud> >;
746  using ConstPtr = shared_ptr<const PointCloudColorHandlerGenericField<PointCloud> >;
747 
748  /** \brief Constructor. */
750  const std::string &field_name);
751 
753  getColor () const override;
754 
755  protected:
756  /** \brief Get the name of the class. */
757  virtual std::string
758  getName () const { return ("PointCloudColorHandlerGenericField"); }
759 
760  /** \brief Get the name of the field used. */
761  virtual std::string
762  getFieldName () const { return (field_name_); }
763 
764  private:
765  /** \brief Name of the field used to create the color handler. */
766  std::string field_name_;
767  };
768 
769  //////////////////////////////////////////////////////////////////////////////////////
770  /** \brief RGBA handler class for colors. Uses the data present in the "rgba" field as
771  * the color at each point. Transparency is handled.
772  * \author Nizar Sallem
773  * \ingroup visualization
774  */
775  template <>
777  {
781 
782  public:
783  using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointCloud> >;
784  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointCloud> >;
785 
786  /** \brief Constructor. */
788 
790  getColor () const override;
791 
792  protected:
793  /** \brief Get the name of the class. */
794  virtual std::string
795  getName () const { return ("PointCloudColorHandlerRGBAField"); }
796 
797  /** \brief Get the name of the field used. */
798  virtual std::string
799  getFieldName () const { return ("rgba"); }
800  };
801 
802  //////////////////////////////////////////////////////////////////////////////////////
803  /** \brief Label field handler class for colors. Paints the points according to their
804  * labels, assigning a unique color from a predefined color lookup table to each label.
805  * \author Sergey Alexandrov
806  * \ingroup visualization
807  */
808  template <>
810  {
814 
815  public:
816  using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointCloud> >;
817  using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointCloud> >;
818 
819  /** \brief Constructor.
820  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
822  const bool static_mapping = true);
823 
825  getColor () const override;
826 
827  protected:
828  /** \brief Get the name of the class. */
829  virtual std::string
830  getName () const { return ("PointCloudColorHandlerLabelField"); }
831 
832  /** \brief Get the name of the field used. */
833  virtual std::string
834  getFieldName () const { return ("label"); }
835  private:
836  bool static_mapping_;
837  };
838 
839  }
840 }
841 
842 #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:173
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:413
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:414
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.
PointCloudColorHandlerGenericField(const PointCloudConstPtr &cloud, const std::string &field_name)
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 std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerGenericField(const PointCloudConstPtr &cloud, const std::string &field_name)
Constructor.
virtual std::string getName() const
Class getName method.
PointCloudColorHandlerGenericField(const std::string &field_name)
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.
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:323
A point structure representing Euclidean xyz coordinates, and the RGB color.