Point Cloud Library (PCL)  1.9.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/point_cloud.h>
46 #include <pcl/common/io.h>
47 #include <pcl/visualization/common/common.h>
48 // VTK includes
49 #include <vtkSmartPointer.h>
50 #include <vtkDataArray.h>
51 #include <vtkFloatArray.h>
52 #include <vtkUnsignedCharArray.h>
53 
54 namespace pcl
55 {
56  namespace visualization
57  {
58  //////////////////////////////////////////////////////////////////////////////////////
59  /** \brief Base Handler class for PointCloud colors.
60  * \author Radu B. Rusu
61  * \ingroup visualization
62  */
63  template <typename PointT>
65  {
66  public:
68  using PointCloudPtr = typename PointCloud::Ptr;
70 
71  using Ptr = boost::shared_ptr<PointCloudColorHandler<PointT> >;
72  using ConstPtr = boost::shared_ptr<const PointCloudColorHandler<PointT> >;
73 
74  /** \brief Constructor. */
76  cloud_ (), capable_ (false), field_idx_ (-1), fields_ ()
77  {}
78 
79  /** \brief Constructor. */
81  cloud_ (cloud), capable_ (false), field_idx_ (-1), fields_ ()
82  {}
83 
84  /** \brief Destructor. */
86 
87  /** \brief Check if this handler is capable of handling the input data or not. */
88  inline bool
89  isCapable () const { return (capable_); }
90 
91  /** \brief Abstract getName method. */
92  virtual std::string
93  getName () const = 0;
94 
95  /** \brief Abstract getFieldName method. */
96  virtual std::string
97  getFieldName () const = 0;
98 
99  /** Obtain the actual color for the input dataset as a VTK data array.
100  * Deriving handlers should override this method. The default implementation is
101  * provided only for backwards compatibility with handlers that were written
102  * before PCL 1.10.0 and will be removed in future.
103  * \return smart pointer to VTK array if the operation was successful (the
104  * handler is capable and the input cloud was given), a null pointer otherwise */
106  getColor () const {
108  getColor (scalars);
109  return scalars;
110  }
111 
112  /** Obtain the actual color for the input dataset as a VTK data array.
113  * This virtual method should not be overriden or used. The default implementation
114  * is provided only for backwards compatibility with handlers that were written
115  * before PCL 1.10.0 and will be removed in future. */
116  [[deprecated("use getColor() without parameters instead")]]
117  virtual bool
119  scalars = getColor ();
120  return scalars.Get() != nullptr;
121  }
122 
123  /** \brief Set the input cloud to be used.
124  * \param[in] cloud the input cloud to be used by the handler
125  */
126  virtual void
128  {
129  cloud_ = cloud;
130  }
131 
132  protected:
133  /** \brief A pointer to the input dataset. */
135 
136  /** \brief True if this handler is capable of handling the input data, false
137  * otherwise.
138  */
139  bool capable_;
140 
141  /** \brief The index of the field holding the data that represents the color. */
143 
144  /** \brief The list of fields available for this PointCloud. */
145  std::vector<pcl::PCLPointField> fields_;
146  };
147 
148  //////////////////////////////////////////////////////////////////////////////////////
149  /** \brief Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen)
150  * \author Radu B. Rusu
151  * \ingroup visualization
152  */
153  template <typename PointT>
155  {
157  using PointCloudPtr = typename PointCloud::Ptr;
158  using PointCloudConstPtr = typename PointCloud::ConstPtr;
159 
160  public:
161  using Ptr = boost::shared_ptr<PointCloudColorHandlerRandom<PointT> >;
162  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerRandom<PointT> >;
163 
164  /** \brief Constructor. */
167  {
168  capable_ = true;
169  }
170 
171  /** \brief Constructor. */
174  {
175  capable_ = true;
176  }
177 
178  /** \brief Abstract getName method. */
179  virtual std::string
180  getName () const { return ("PointCloudColorHandlerRandom"); }
181 
182  /** \brief Get the name of the field used. */
183  virtual std::string
184  getFieldName () const { return ("[random]"); }
185 
187  getColor () const override;
188 
190 
191  protected:
192  // Members derived from the base class
195  };
196 
197  //////////////////////////////////////////////////////////////////////////////////////
198  /** \brief Handler for predefined user colors. The color at each point will be drawn
199  * as the use given R, G, B values.
200  * \author Radu B. Rusu
201  * \ingroup visualization
202  */
203  template <typename PointT>
205  {
207  using PointCloudPtr = typename PointCloud::Ptr;
208  using PointCloudConstPtr = typename PointCloud::ConstPtr;
209 
210  public:
211  using Ptr = boost::shared_ptr<PointCloudColorHandlerCustom<PointT> >;
212  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerCustom<PointT> >;
213 
214  /** \brief Constructor. */
215  PointCloudColorHandlerCustom (double r, double g, double b)
217  , r_ (r)
218  , g_ (g)
219  , b_ (b)
220  {
221  capable_ = true;
222  }
223 
224  /** \brief Constructor. */
226  double r, double g, double b)
227  : PointCloudColorHandler<PointT> (cloud)
228  , r_ (r)
229  , g_ (g)
230  , b_ (b)
231  {
232  capable_ = true;
233  }
234 
235  /** \brief Destructor. */
237 
238  /** \brief Abstract getName method. */
239  virtual std::string
240  getName () const { return ("PointCloudColorHandlerCustom"); }
241 
242  /** \brief Get the name of the field used. */
243  virtual std::string
244  getFieldName () const { return (""); }
245 
247  getColor () const override;
248 
250 
251  protected:
252  // Members derived from the base class
255 
256  /** \brief Internal R, G, B holding the values given by the user. */
257  double r_, g_, b_;
258  };
259 
260  //////////////////////////////////////////////////////////////////////////////////////
261  /** \brief RGB handler class for colors. Uses the data present in the "rgb" or "rgba"
262  * fields as the color at each point.
263  * \author Radu B. Rusu
264  * \ingroup visualization
265  */
266  template <typename PointT>
268  {
270  using PointCloudPtr = typename PointCloud::Ptr;
271  using PointCloudConstPtr = typename PointCloud::ConstPtr;
272 
273  public:
274  using Ptr = boost::shared_ptr<PointCloudColorHandlerRGBField<PointT> >;
275  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerRGBField<PointT> >;
276 
277  /** \brief Constructor. */
279  {
280  capable_ = false;
281  }
282 
283  /** \brief Constructor. */
285  : PointCloudColorHandler<PointT> (cloud)
286  {
287  setInputCloud (cloud);
288  }
289 
290  /** \brief Destructor. */
292 
293  /** \brief Get the name of the field used. */
294  virtual std::string
295  getFieldName () const { return ("rgb"); }
296 
298  getColor () const override;
299 
301 
302  /** \brief Set the input cloud to be used.
303  * \param[in] cloud the input cloud to be used by the handler
304  */
305  virtual void
306  setInputCloud (const PointCloudConstPtr &cloud);
307 
308  protected:
309  /** \brief Class getName method. */
310  virtual std::string
311  getName () const { return ("PointCloudColorHandlerRGBField"); }
312 
313  private:
314  // Members derived from the base class
319  };
320 
321  //////////////////////////////////////////////////////////////////////////////////////
322  /** \brief HSV handler class for colors. Uses the data present in the "h", "s", "v"
323  * fields as the color at each point.
324  * \ingroup visualization
325  */
326  template <typename PointT>
328  {
330  using PointCloudPtr = typename PointCloud::Ptr;
331  using PointCloudConstPtr = typename PointCloud::ConstPtr;
332 
333  public:
334  using Ptr = boost::shared_ptr<PointCloudColorHandlerHSVField<PointT> >;
335  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerHSVField<PointT> >;
336 
337  /** \brief Constructor. */
339 
340  /** \brief Empty destructor */
342 
343  /** \brief Get the name of the field used. */
344  virtual std::string
345  getFieldName () const { return ("hsv"); }
346 
348  getColor () const override;
349 
351 
352  protected:
353  /** \brief Class getName method. */
354  virtual std::string
355  getName () const { return ("PointCloudColorHandlerHSVField"); }
356 
357  /** \brief The field index for "S". */
359 
360  /** \brief The field index for "V". */
362  private:
363  // Members derived from the base class
368  };
369 
370  //////////////////////////////////////////////////////////////////////////////////////
371  /** \brief Generic field handler class for colors. Uses an user given field to extract
372  * 1D data and display the color at each point using a min-max lookup table.
373  * \author Radu B. Rusu
374  * \ingroup visualization
375  */
376  template <typename PointT>
378  {
380  using PointCloudPtr = typename PointCloud::Ptr;
381  using PointCloudConstPtr = typename PointCloud::ConstPtr;
382 
383  public:
384  using Ptr = boost::shared_ptr<PointCloudColorHandlerGenericField<PointT> >;
385  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerGenericField<PointT> >;
386 
387  /** \brief Constructor. */
388  PointCloudColorHandlerGenericField (const std::string &field_name)
389  : field_name_ (field_name)
390  {
391  capable_ = false;
392  }
393 
394  /** \brief Constructor. */
396  const std::string &field_name)
397  : PointCloudColorHandler<PointT> (cloud)
398  , field_name_ (field_name)
399  {
400  setInputCloud (cloud);
401  }
402 
403  /** \brief Destructor. */
405 
406  /** \brief Get the name of the field used. */
407  virtual std::string getFieldName () const { return (field_name_); }
408 
410  getColor () const override;
411 
413 
414  /** \brief Set the input cloud to be used.
415  * \param[in] cloud the input cloud to be used by the handler
416  */
417  virtual void
418  setInputCloud (const PointCloudConstPtr &cloud);
419 
420  protected:
421  /** \brief Class getName method. */
422  virtual std::string
423  getName () const { return ("PointCloudColorHandlerGenericField"); }
424 
425  private:
430 
431  /** \brief Name of the field used to create the color handler. */
432  std::string field_name_;
433  };
434 
435 
436  //////////////////////////////////////////////////////////////////////////////////////
437  /** \brief RGBA handler class for colors. Uses the data present in the "rgba" field as
438  * the color at each point. Transparency is handled.
439  * \author Nizar Sallem
440  * \ingroup visualization
441  */
442  template <typename PointT>
444  {
446  using PointCloudPtr = typename PointCloud::Ptr;
447  using PointCloudConstPtr = typename PointCloud::ConstPtr;
448 
449  public:
450  using Ptr = boost::shared_ptr<PointCloudColorHandlerRGBAField<PointT> >;
451  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerRGBAField<PointT> >;
452 
453  /** \brief Constructor. */
455  {
456  capable_ = false;
457  }
458 
459  /** \brief Constructor. */
461  : PointCloudColorHandler<PointT> (cloud)
462  {
463  setInputCloud (cloud);
464  }
465 
466  /** \brief Destructor. */
468 
469  /** \brief Get the name of the field used. */
470  virtual std::string
471  getFieldName () const { return ("rgba"); }
472 
474  getColor () const override;
475 
477 
478  /** \brief Set the input cloud to be used.
479  * \param[in] cloud the input cloud to be used by the handler
480  */
481  virtual void
482  setInputCloud (const PointCloudConstPtr &cloud);
483 
484  protected:
485  /** \brief Class getName method. */
486  virtual std::string
487  getName () const { return ("PointCloudColorHandlerRGBAField"); }
488 
489  private:
490  // Members derived from the base class
495  };
496 
497  //////////////////////////////////////////////////////////////////////////////////////
498  /** \brief Label field handler class for colors. Paints the points according to their
499  * labels, assigning a unique color from a predefined color lookup table to each label.
500  * \author Sergey Alexandrov
501  * \ingroup visualization
502  */
503  template <typename PointT>
505  {
507  using PointCloudPtr = typename PointCloud::Ptr;
508  using PointCloudConstPtr = typename PointCloud::ConstPtr;
509 
510  public:
511  using Ptr = boost::shared_ptr<PointCloudColorHandlerLabelField<PointT> >;
512  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerLabelField<PointT> >;
513 
514  /** \brief Constructor.
515  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
516  PointCloudColorHandlerLabelField (const bool static_mapping = true)
518  {
519  capable_ = false;
520  static_mapping_ = static_mapping;
521  }
522 
523  /** \brief Constructor.
524  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
526  const bool static_mapping = true)
527  : PointCloudColorHandler<PointT> (cloud)
528  {
529  setInputCloud (cloud);
530  static_mapping_ = static_mapping;
531  }
532 
533  /** \brief Destructor. */
535 
536  /** \brief Get the name of the field used. */
537  virtual std::string
538  getFieldName () const { return ("label"); }
539 
541  getColor () const override;
542 
544 
545  /** \brief Set the input cloud to be used.
546  * \param[in] cloud the input cloud to be used by the handler
547  */
548  virtual void
549  setInputCloud (const PointCloudConstPtr &cloud);
550 
551  protected:
552  /** \brief Class getName method. */
553  virtual std::string
554  getName () const { return ("PointCloudColorHandlerLabelField"); }
555 
556  private:
557  // Members derived from the base class
562  bool static_mapping_;
563  };
564 
565  //////////////////////////////////////////////////////////////////////////////////////
566  /** \brief Base Handler class for PointCloud colors.
567  * \author Radu B. Rusu
568  * \ingroup visualization
569  */
570  template <>
572  {
573  public:
577 
578  using Ptr = boost::shared_ptr<PointCloudColorHandler<PointCloud> >;
579  using ConstPtr = boost::shared_ptr<const PointCloudColorHandler<PointCloud> >;
580 
581  /** \brief Constructor. */
583  cloud_ (cloud), capable_ (false), field_idx_ ()
584  {}
585 
586  /** \brief Destructor. */
588 
589  /** \brief Return whether this handler is capable of handling the input data or not. */
590  inline bool
591  isCapable () const { return (capable_); }
592 
593  /** \brief Abstract getName method. */
594  virtual std::string
595  getName () const = 0;
596 
597  /** \brief Abstract getFieldName method. */
598  virtual std::string
599  getFieldName () const = 0;
600 
601  /** Obtain the actual color for the input dataset as a VTK data array.
602  * Deriving handlers should override this method. The default implementation is
603  * provided only for backwards compatibility with handlers that were written
604  * before PCL 1.10.0 and will be removed in future.
605  * \return smart pointer to VTK array if the operation was successful (the
606  * handler is capable and the input cloud was given), a null pointer otherwise */
608  getColor () const {
610  getColor (scalars);
611  return scalars;
612  }
613 
614  /** Obtain the actual color for the input dataset as a VTK data array.
615  * This virtual method should not be overriden or used. The default implementation
616  * is provided only for backwards compatibility with handlers that were written
617  * before PCL 1.10.0 and will be removed in future. */
618  [[deprecated("use getColor() without parameters instead")]]
619  virtual bool
621  scalars = getColor ();
622  return scalars.Get() != nullptr;
623  }
624 
625  /** \brief Set the input cloud to be used.
626  * \param[in] cloud the input cloud to be used by the handler
627  */
628  void
630  {
631  cloud_ = cloud;
632  }
633 
634  protected:
635  /** \brief A pointer to the input dataset. */
637 
638  /** \brief True if this handler is capable of handling the input data, false
639  * otherwise.
640  */
641  bool capable_;
642 
643  /** \brief The index of the field holding the data that represents the color. */
645  };
646 
647  //////////////////////////////////////////////////////////////////////////////////////
648  /** \brief Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen)
649  * \author Radu B. Rusu
650  * \ingroup visualization
651  */
652  template <>
654  {
658 
659  public:
660  using Ptr = boost::shared_ptr<PointCloudColorHandlerRandom<PointCloud> >;
661  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerRandom<PointCloud> >;
662 
663  /** \brief Constructor. */
666  {
667  capable_ = true;
668  }
669 
670  /** \brief Empty destructor */
672 
673  /** \brief Get the name of the class. */
674  virtual std::string
675  getName () const { return ("PointCloudColorHandlerRandom"); }
676 
677  /** \brief Get the name of the field used. */
678  virtual std::string
679  getFieldName () const { return ("[random]"); }
680 
682  getColor () const override;
683 
685  };
686 
687  //////////////////////////////////////////////////////////////////////////////////////
688  /** \brief Handler for predefined user colors. The color at each point will be drawn
689  * as the use given R, G, B values.
690  * \author Radu B. Rusu
691  * \ingroup visualization
692  */
693  template <>
695  {
699 
700  public:
701  /** \brief Constructor. */
703  double r, double g, double b) :
705  r_ (r), g_ (g), b_ (b)
706  {
707  capable_ = true;
708  }
709 
710  /** \brief Empty destructor */
712 
713  /** \brief Get the name of the class. */
714  virtual std::string
715  getName () const { return ("PointCloudColorHandlerCustom"); }
716 
717  /** \brief Get the name of the field used. */
718  virtual std::string
719  getFieldName () const { return (""); }
720 
722  getColor () const override;
723 
725 
726  protected:
727  /** \brief Internal R, G, B holding the values given by the user. */
728  double r_, g_, b_;
729  };
730 
731  //////////////////////////////////////////////////////////////////////////////////////
732  /** \brief RGB handler class for colors. Uses the data present in the "rgb" or "rgba"
733  * fields as the color at each point.
734  * \author Radu B. Rusu
735  * \ingroup visualization
736  */
737  template <>
739  {
743 
744  public:
745  using Ptr = boost::shared_ptr<PointCloudColorHandlerRGBField<PointCloud> >;
746  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerRGBField<PointCloud> >;
747 
748  /** \brief Constructor. */
750 
751  /** \brief Empty destructor */
753 
755  getColor () const override;
756 
758 
759  protected:
760  /** \brief Get the name of the class. */
761  virtual std::string
762  getName () const { return ("PointCloudColorHandlerRGBField"); }
763 
764  /** \brief Get the name of the field used. */
765  virtual std::string
766  getFieldName () const { return ("rgb"); }
767  };
768 
769  //////////////////////////////////////////////////////////////////////////////////////
770  /** \brief HSV handler class for colors. Uses the data present in the "h", "s", "v"
771  * fields as the color at each point.
772  * \ingroup visualization
773  */
774  template <>
776  {
780 
781  public:
782  using Ptr = boost::shared_ptr<PointCloudColorHandlerHSVField<PointCloud> >;
783  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerHSVField<PointCloud> >;
784 
785  /** \brief Constructor. */
787 
788  /** \brief Empty destructor */
790 
792  getColor () const override;
793 
795 
796  protected:
797  /** \brief Get the name of the class. */
798  virtual std::string
799  getName () const { return ("PointCloudColorHandlerHSVField"); }
800 
801  /** \brief Get the name of the field used. */
802  virtual std::string
803  getFieldName () const { return ("hsv"); }
804 
805  /** \brief The field index for "S". */
807 
808  /** \brief The field index for "V". */
810  };
811 
812  //////////////////////////////////////////////////////////////////////////////////////
813  /** \brief Generic field handler class for colors. Uses an user given field to extract
814  * 1D data and display the color at each point using a min-max lookup table.
815  * \author Radu B. Rusu
816  * \ingroup visualization
817  */
818  template <>
820  {
824 
825  public:
826  using Ptr = boost::shared_ptr<PointCloudColorHandlerGenericField<PointCloud> >;
827  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerGenericField<PointCloud> >;
828 
829  /** \brief Constructor. */
831  const std::string &field_name);
832 
833  /** \brief Empty destructor */
835 
837  getColor () const override;
838 
840 
841  protected:
842  /** \brief Get the name of the class. */
843  virtual std::string
844  getName () const { return ("PointCloudColorHandlerGenericField"); }
845 
846  /** \brief Get the name of the field used. */
847  virtual std::string
848  getFieldName () const { return (field_name_); }
849 
850  private:
851  /** \brief Name of the field used to create the color handler. */
852  std::string field_name_;
853  };
854 
855  //////////////////////////////////////////////////////////////////////////////////////
856  /** \brief RGBA handler class for colors. Uses the data present in the "rgba" field as
857  * the color at each point. Transparency is handled.
858  * \author Nizar Sallem
859  * \ingroup visualization
860  */
861  template <>
863  {
867 
868  public:
869  using Ptr = boost::shared_ptr<PointCloudColorHandlerRGBAField<PointCloud> >;
870  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerRGBAField<PointCloud> >;
871 
872  /** \brief Constructor. */
874 
875  /** \brief Empty destructor */
877 
879  getColor () const override;
880 
882 
883  protected:
884  /** \brief Get the name of the class. */
885  virtual std::string
886  getName () const { return ("PointCloudColorHandlerRGBAField"); }
887 
888  /** \brief Get the name of the field used. */
889  virtual std::string
890  getFieldName () const { return ("rgba"); }
891  };
892 
893  //////////////////////////////////////////////////////////////////////////////////////
894  /** \brief Label field handler class for colors. Paints the points according to their
895  * labels, assigning a unique color from a predefined color lookup table to each label.
896  * \author Sergey Alexandrov
897  * \ingroup visualization
898  */
899  template <>
901  {
905 
906  public:
907  using Ptr = boost::shared_ptr<PointCloudColorHandlerLabelField<PointCloud> >;
908  using ConstPtr = boost::shared_ptr<const PointCloudColorHandlerLabelField<PointCloud> >;
909 
910  /** \brief Constructor.
911  * \param[in] static_mapping Use a static colormapping from label_id to color (default true) */
913  const bool static_mapping = true);
914 
915  /** \brief Empty destructor */
917 
919  getColor () const override;
920 
922 
923  protected:
924  /** \brief Get the name of the class. */
925  virtual std::string
926  getName () const { return ("PointCloudColorHandlerLabelField"); }
927 
928  /** \brief Get the name of the field used. */
929  virtual std::string
930  getFieldName () const { return ("label"); }
931  private:
932  bool static_mapping_;
933  };
934 
935  }
936 }
937 
938 #include <pcl/visualization/impl/point_cloud_color_handlers.hpp>
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getFieldName() const
Get the name of the field used.
Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen)
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getName() const
Class getName method.
virtual std::string getName() const
Class getName method.
virtual std::string getFieldName() const
Get the name of the field used.
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
virtual std::string getName() const
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 bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
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.
boost::shared_ptr< const PointCloudColorHandler< PointT > > ConstPtr
PointCloudColorHandlerLabelField(const PointCloudConstPtr &cloud, const bool static_mapping=true)
Constructor.
PointCloudColorHandlerRGBField(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandler(const PointCloudConstPtr &cloud)
Constructor.
bool isCapable() const
Return whether this handler is capable of handling the input data or not.
virtual std::string getFieldName() const
Get the name of the field used.
Base Handler class for PointCloud colors.
virtual std::string getFieldName() const
Get the name of the field used.
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 vtkSmartPointer< vtkDataArray > getColor() const
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getName() const
Abstract getName method.
PointCloudColorHandlerGenericField(const std::string &field_name)
Constructor.
virtual std::string getName() const
Class getName method.
double r_
Internal R, G, B holding the values given by the user.
virtual vtkSmartPointer< vtkDataArray > getColor() const
Obtain the actual color for the input dataset as a VTK data array.
PointCloudColorHandlerRandom(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
boost::shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:444
boost::shared_ptr< const PointCloudColorHandler< PointCloud > > ConstPtr
virtual std::string getName() const
Class getName method.
boost::shared_ptr< PointCloudColorHandler< PointCloud > > Ptr
virtual std::string getFieldName() const
Get the name of the field used.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerRGBAField(const PointCloudConstPtr &cloud)
Constructor.
int field_idx_
The index of the field holding the data that represents the color.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:445
boost::shared_ptr< PointCloudColorHandler< PointT > > Ptr
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudConstPtr cloud_
A pointer to the input dataset.
virtual std::string getFieldName() const
Get the name of the field used.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
virtual std::string getFieldName() const =0
Abstract getFieldName method.
PointCloudColorHandlerGenericField(const PointCloudConstPtr &cloud, const std::string &field_name)
Constructor.
virtual std::string getFieldName() const
Get the name of the field used.
int field_idx_
The index of the field holding the data that represents the color.
A point structure representing Euclidean xyz coordinates, and the RGB color.
virtual std::string getName() const =0
Abstract getName method.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
Obtain the actual color for the input dataset as a VTK data array.
double r_
Internal R, G, B holding the values given by the user.
#define PCL_EXPORTS
Definition: pcl_macros.h:227
PointCloudColorHandlerCustom(const PointCloudConstPtr &cloud, double r, double g, double b)
Constructor.
virtual std::string getFieldName() const
Get the name of the field used.