Point Cloud Library (PCL)  1.12.0
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. */
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 Destructor. */
219 
220  /** \brief Abstract getName method. */
221  virtual std::string
222  getName () const { return ("PointCloudColorHandlerCustom"); }
223 
224  /** \brief Get the name of the field used. */
225  virtual std::string
226  getFieldName () const { return (""); }
227 
229  getColor () const override;
230 
231  protected:
232  // Members derived from the base class
235 
236  /** \brief Internal R, G, B holding the values given by the user. */
237  double r_, g_, b_;
238  };
239 
240  //////////////////////////////////////////////////////////////////////////////////////
241  /** \brief RGB handler class for colors. Uses the data present in the "rgb" or "rgba"
242  * fields as the color at each point.
243  * \author Radu B. Rusu
244  * \ingroup visualization
245  */
246  template <typename PointT>
248  {
250  using PointCloudPtr = typename PointCloud::Ptr;
251  using PointCloudConstPtr = typename PointCloud::ConstPtr;
252 
253  public:
254  using Ptr = shared_ptr<PointCloudColorHandlerRGBField<PointT> >;
255  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBField<PointT> >;
256 
257  /** \brief Constructor. */
259  {
260  capable_ = false;
261  }
262 
263  /** \brief Constructor. */
265  : PointCloudColorHandler<PointT> (cloud)
266  {
267  setInputCloud (cloud);
268  }
269 
270  /** \brief Destructor. */
272 
273  /** \brief Get the name of the field used. */
274  virtual std::string
275  getFieldName () const { return ("rgb"); }
276 
278  getColor () const override;
279 
280  /** \brief Set the input cloud to be used.
281  * \param[in] cloud the input cloud to be used by the handler
282  */
283  virtual void
284  setInputCloud (const PointCloudConstPtr &cloud);
285 
286  protected:
287  /** \brief Class getName method. */
288  virtual std::string
289  getName () const { return ("PointCloudColorHandlerRGBField"); }
290 
291  private:
292  // Members derived from the base class
297  };
298 
299  //////////////////////////////////////////////////////////////////////////////////////
300  /** \brief HSV handler class for colors. Uses the data present in the "h", "s", "v"
301  * fields as the color at each point.
302  * \ingroup visualization
303  */
304  template <typename PointT>
306  {
308  using PointCloudPtr = typename PointCloud::Ptr;
309  using PointCloudConstPtr = typename PointCloud::ConstPtr;
310 
311  public:
312  using Ptr = shared_ptr<PointCloudColorHandlerHSVField<PointT> >;
313  using ConstPtr = shared_ptr<const PointCloudColorHandlerHSVField<PointT> >;
314 
315  /** \brief Constructor. */
317 
318  /** \brief Empty destructor */
320 
321  /** \brief Get the name of the field used. */
322  virtual std::string
323  getFieldName () const { return ("hsv"); }
324 
326  getColor () const override;
327 
328  protected:
329  /** \brief Class getName method. */
330  virtual std::string
331  getName () const { return ("PointCloudColorHandlerHSVField"); }
332 
333  /** \brief The field index for "S". */
335 
336  /** \brief The field index for "V". */
338  private:
339  // Members derived from the base class
344  };
345 
346  //////////////////////////////////////////////////////////////////////////////////////
347  /** \brief Generic field handler class for colors. Uses an user given field to extract
348  * 1D data and display the color at each point using a min-max lookup table.
349  * \author Radu B. Rusu
350  * \ingroup visualization
351  */
352  template <typename PointT>
354  {
356  using PointCloudPtr = typename PointCloud::Ptr;
357  using PointCloudConstPtr = typename PointCloud::ConstPtr;
358 
359  public:
360  using Ptr = shared_ptr<PointCloudColorHandlerGenericField<PointT> >;
361  using ConstPtr = shared_ptr<const PointCloudColorHandlerGenericField<PointT> >;
362 
363  /** \brief Constructor. */
364  PointCloudColorHandlerGenericField (const std::string &field_name)
365  : field_name_ (field_name)
366  {
367  capable_ = false;
368  }
369 
370  /** \brief Constructor. */
372  const std::string &field_name)
373  : PointCloudColorHandler<PointT> (cloud)
374  , field_name_ (field_name)
375  {
376  setInputCloud (cloud);
377  }
378 
379  /** \brief Destructor. */
381 
382  /** \brief Get the name of the field used. */
383  virtual std::string getFieldName () const { return (field_name_); }
384 
386  getColor () const override;
387 
388  /** \brief Set the input cloud to be used.
389  * \param[in] cloud the input cloud to be used by the handler
390  */
391  virtual void
392  setInputCloud (const PointCloudConstPtr &cloud);
393 
394  protected:
395  /** \brief Class getName method. */
396  virtual std::string
397  getName () const { return ("PointCloudColorHandlerGenericField"); }
398 
399  private:
404 
405  /** \brief Name of the field used to create the color handler. */
406  std::string field_name_;
407  };
408 
409 
410  //////////////////////////////////////////////////////////////////////////////////////
411  /** \brief RGBA handler class for colors. Uses the data present in the "rgba" field as
412  * the color at each point. Transparency is handled.
413  * \author Nizar Sallem
414  * \ingroup visualization
415  */
416  template <typename PointT>
418  {
420  using PointCloudPtr = typename PointCloud::Ptr;
421  using PointCloudConstPtr = typename PointCloud::ConstPtr;
422 
423  public:
424  using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointT> >;
425  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointT> >;
426 
427  /** \brief Constructor. */
429  {
430  capable_ = false;
431  }
432 
433  /** \brief Constructor. */
435  : PointCloudColorHandler<PointT> (cloud)
436  {
437  setInputCloud (cloud);
438  }
439 
440  /** \brief Destructor. */
442 
443  /** \brief Get the name of the field used. */
444  virtual std::string
445  getFieldName () const { return ("rgba"); }
446 
448  getColor () const override;
449 
450  /** \brief Set the input cloud to be used.
451  * \param[in] cloud the input cloud to be used by the handler
452  */
453  virtual void
454  setInputCloud (const PointCloudConstPtr &cloud);
455 
456  protected:
457  /** \brief Class getName method. */
458  virtual std::string
459  getName () const { return ("PointCloudColorHandlerRGBAField"); }
460 
461  private:
462  // Members derived from the base class
467  };
468 
469  //////////////////////////////////////////////////////////////////////////////////////
470  /** \brief Label field handler class for colors. Paints the points according to their
471  * labels, assigning a unique color from a predefined color lookup table to each label.
472  * \author Sergey Alexandrov
473  * \ingroup visualization
474  */
475  template <typename PointT>
477  {
479  using PointCloudPtr = typename PointCloud::Ptr;
480  using PointCloudConstPtr = typename PointCloud::ConstPtr;
481 
482  public:
483  using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointT> >;
484  using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointT> >;
485 
486  /** \brief Constructor.
487  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
488  PointCloudColorHandlerLabelField (const bool static_mapping = true)
490  {
491  capable_ = false;
492  static_mapping_ = static_mapping;
493  }
494 
495  /** \brief Constructor.
496  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
498  const bool static_mapping = true)
499  : PointCloudColorHandler<PointT> (cloud)
500  {
501  setInputCloud (cloud);
502  static_mapping_ = static_mapping;
503  }
504 
505  /** \brief Destructor. */
507 
508  /** \brief Get the name of the field used. */
509  virtual std::string
510  getFieldName () const { return ("label"); }
511 
513  getColor () const override;
514 
516 
517  /** \brief Set the input cloud to be used.
518  * \param[in] cloud the input cloud to be used by the handler
519  */
520  virtual void
521  setInputCloud (const PointCloudConstPtr &cloud);
522 
523  protected:
524  /** \brief Class getName method. */
525  virtual std::string
526  getName () const { return ("PointCloudColorHandlerLabelField"); }
527 
528  private:
529  // Members derived from the base class
534  bool static_mapping_;
535  };
536 
537  //////////////////////////////////////////////////////////////////////////////////////
538  /** \brief Base Handler class for PointCloud colors.
539  * \author Radu B. Rusu
540  * \ingroup visualization
541  */
542  template <>
544  {
545  public:
549 
550  using Ptr = shared_ptr<PointCloudColorHandler<PointCloud> >;
551  using ConstPtr = shared_ptr<const PointCloudColorHandler<PointCloud> >;
552 
553  /** \brief Constructor. */
555  cloud_ (cloud), capable_ (false), field_idx_ ()
556  {}
557 
558  /** \brief Destructor. */
560 
561  /** \brief Return whether this handler is capable of handling the input data or not. */
562  inline bool
563  isCapable () const { return (capable_); }
564 
565  /** \brief Abstract getName method. */
566  virtual std::string
567  getName () const = 0;
568 
569  /** \brief Abstract getFieldName method. */
570  virtual std::string
571  getFieldName () const = 0;
572 
573  /** Obtain the actual color for the input dataset as a VTK data array.
574  * Deriving handlers should override this method. The default implementation is
575  * provided only for backwards compatibility with handlers that were written
576  * before PCL 1.10.0 and will be removed in future.
577  * \return smart pointer to VTK array if the operation was successful (the
578  * handler is capable and the input cloud was given), a null pointer otherwise */
580  getColor() const = 0;
581 
582  /** \brief Set the input cloud to be used.
583  * \param[in] cloud the input cloud to be used by the handler
584  */
585  void
587  {
588  cloud_ = cloud;
589  }
590 
591  protected:
592  /** \brief A pointer to the input dataset. */
594 
595  /** \brief True if this handler is capable of handling the input data, false
596  * otherwise.
597  */
598  bool capable_;
599 
600  /** \brief The index of the field holding the data that represents the color. */
602  };
603 
604  //////////////////////////////////////////////////////////////////////////////////////
605  /** \brief Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen)
606  * \author Radu B. Rusu
607  * \ingroup visualization
608  */
609  template <>
611  {
615 
616  public:
617  using Ptr = shared_ptr<PointCloudColorHandlerRandom<PointCloud> >;
618  using ConstPtr = shared_ptr<const PointCloudColorHandlerRandom<PointCloud> >;
619 
620  /** \brief Constructor. */
623  {
624  capable_ = true;
625  }
626 
627  /** \brief Empty destructor */
629 
630  /** \brief Get the name of the class. */
631  virtual std::string
632  getName () const { return ("PointCloudColorHandlerRandom"); }
633 
634  /** \brief Get the name of the field used. */
635  virtual std::string
636  getFieldName () const { return ("[random]"); }
637 
639  getColor () const override;
640  };
641 
642  //////////////////////////////////////////////////////////////////////////////////////
643  /** \brief Handler for predefined user colors. The color at each point will be drawn
644  * as the use given R, G, B values.
645  * \author Radu B. Rusu
646  * \ingroup visualization
647  */
648  template <>
650  {
654 
655  public:
656  /** \brief Constructor. */
658  double r, double g, double b) :
660  r_ (r), g_ (g), b_ (b)
661  {
662  capable_ = true;
663  }
664 
665  /** \brief Empty destructor */
667 
668  /** \brief Get the name of the class. */
669  virtual std::string
670  getName () const { return ("PointCloudColorHandlerCustom"); }
671 
672  /** \brief Get the name of the field used. */
673  virtual std::string
674  getFieldName () const { return (""); }
675 
677  getColor () const override;
678 
679  protected:
680  /** \brief Internal R, G, B holding the values given by the user. */
681  double r_, g_, b_;
682  };
683 
684  //////////////////////////////////////////////////////////////////////////////////////
685  /** \brief RGB handler class for colors. Uses the data present in the "rgb" or "rgba"
686  * fields as the color at each point.
687  * \author Radu B. Rusu
688  * \ingroup visualization
689  */
690  template <>
692  {
696 
697  public:
698  using Ptr = shared_ptr<PointCloudColorHandlerRGBField<PointCloud> >;
699  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBField<PointCloud> >;
700 
701  /** \brief Constructor. */
703 
704  /** \brief Empty destructor */
706 
708  getColor () const override;
709 
710  protected:
711  /** \brief Get the name of the class. */
712  virtual std::string
713  getName () const { return ("PointCloudColorHandlerRGBField"); }
714 
715  /** \brief Get the name of the field used. */
716  virtual std::string
717  getFieldName () const { return ("rgb"); }
718  };
719 
720  //////////////////////////////////////////////////////////////////////////////////////
721  /** \brief HSV handler class for colors. Uses the data present in the "h", "s", "v"
722  * fields as the color at each point.
723  * \ingroup visualization
724  */
725  template <>
727  {
731 
732  public:
733  using Ptr = shared_ptr<PointCloudColorHandlerHSVField<PointCloud> >;
734  using ConstPtr = shared_ptr<const PointCloudColorHandlerHSVField<PointCloud> >;
735 
736  /** \brief Constructor. */
738 
739  /** \brief Empty destructor */
741 
743  getColor () const override;
744 
745  protected:
746  /** \brief Get the name of the class. */
747  virtual std::string
748  getName () const { return ("PointCloudColorHandlerHSVField"); }
749 
750  /** \brief Get the name of the field used. */
751  virtual std::string
752  getFieldName () const { return ("hsv"); }
753 
754  /** \brief The field index for "S". */
756 
757  /** \brief The field index for "V". */
759  };
760 
761  //////////////////////////////////////////////////////////////////////////////////////
762  /** \brief Generic field handler class for colors. Uses an user given field to extract
763  * 1D data and display the color at each point using a min-max lookup table.
764  * \author Radu B. Rusu
765  * \ingroup visualization
766  */
767  template <>
769  {
773 
774  public:
775  using Ptr = shared_ptr<PointCloudColorHandlerGenericField<PointCloud> >;
776  using ConstPtr = shared_ptr<const PointCloudColorHandlerGenericField<PointCloud> >;
777 
778  /** \brief Constructor. */
780  const std::string &field_name);
781 
782  /** \brief Empty destructor */
784 
786  getColor () const override;
787 
788  protected:
789  /** \brief Get the name of the class. */
790  virtual std::string
791  getName () const { return ("PointCloudColorHandlerGenericField"); }
792 
793  /** \brief Get the name of the field used. */
794  virtual std::string
795  getFieldName () const { return (field_name_); }
796 
797  private:
798  /** \brief Name of the field used to create the color handler. */
799  std::string field_name_;
800  };
801 
802  //////////////////////////////////////////////////////////////////////////////////////
803  /** \brief RGBA handler class for colors. Uses the data present in the "rgba" field as
804  * the color at each point. Transparency is handled.
805  * \author Nizar Sallem
806  * \ingroup visualization
807  */
808  template <>
810  {
814 
815  public:
816  using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointCloud> >;
817  using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointCloud> >;
818 
819  /** \brief Constructor. */
821 
822  /** \brief Empty destructor */
824 
826  getColor () const override;
827 
828  protected:
829  /** \brief Get the name of the class. */
830  virtual std::string
831  getName () const { return ("PointCloudColorHandlerRGBAField"); }
832 
833  /** \brief Get the name of the field used. */
834  virtual std::string
835  getFieldName () const { return ("rgba"); }
836  };
837 
838  //////////////////////////////////////////////////////////////////////////////////////
839  /** \brief Label field handler class for colors. Paints the points according to their
840  * labels, assigning a unique color from a predefined color lookup table to each label.
841  * \author Sergey Alexandrov
842  * \ingroup visualization
843  */
844  template <>
846  {
850 
851  public:
852  using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointCloud> >;
853  using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointCloud> >;
854 
855  /** \brief Constructor.
856  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
858  const bool static_mapping = true);
859 
860  /** \brief Empty destructor */
862 
864  getColor () const override;
865 
866  protected:
867  /** \brief Get the name of the class. */
868  virtual std::string
869  getName () const { return ("PointCloudColorHandlerLabelField"); }
870 
871  /** \brief Get the name of the field used. */
872  virtual std::string
873  getFieldName () const { return ("label"); }
874  private:
875  bool static_mapping_;
876  };
877 
878  }
879 }
880 
881 #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
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.