Point Cloud Library (PCL)  1.14.0-dev
range_image_visualizer.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2010, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  *
35  */
36 
37 #pragma once
38 
39 // PCL includes
40 #include <pcl/pcl_config.h>
41 #include <pcl/range_image/range_image.h>
42 #include <pcl/visualization/image_viewer.h>
43 
44 namespace pcl
45 {
46  namespace visualization
47  {
48  /** \brief Range image visualizer class.
49  * \author Bastian Steder
50  * \ingroup visualization
51  */
53  {
54  public:
55  // =====CONSTRUCTOR & DESTRUCTOR=====
56  //! Constructor
57  RangeImageVisualizer (const std::string& name="Range Image");
58  //! Destructor
59  ~RangeImageVisualizer () override;
60 
61  // =====PUBLIC STATIC METHODS=====
62  /** Get a widget visualizing the given range image.
63  * You are responsible for deleting it after usage! */
64  static RangeImageVisualizer* getRangeImageWidget (const pcl::RangeImage& range_image, float min_value,
65  float max_value, bool grayscale, const std::string& name="Range image");
66 
67  /** Visualize the given range image and the detected borders in it.
68  * Borders on the obstacles are marked green, borders on the background are marked bright blue. */
69  void visualizeBorders (const pcl::RangeImage& range_image, float min_value, float max_value, bool grayscale,
70  const pcl::PointCloud<pcl::BorderDescription>& border_descriptions);
71 
72  /** Same as above, but returning a new widget. You are responsible for deleting it after usage! */
73  static RangeImageVisualizer* getRangeImageBordersWidget (const pcl::RangeImage& range_image, float min_value,
74  float max_value, bool grayscale, const pcl::PointCloud<pcl::BorderDescription>& border_descriptions,
75  const std::string& name="Range image with borders");
76 
77  /** Get a widget visualizing the given angle image (assuming values in (-PI, PI]).
78  * -PI and PI will return the same color
79  * You are responsible for deleting it after usage! */
80  static RangeImageVisualizer* getAnglesWidget (const pcl::RangeImage& range_image, float* angles_image, const std::string& name);
81 
82  /** Get a widget visualizing the given angle image (assuming values in (-PI/2, PI/2]).
83  * -PI/2 and PI/2 will return the same color
84  * You are responsible for deleting it after usage! */
85  static RangeImageVisualizer* getHalfAnglesWidget (const pcl::RangeImage& range_image, float* angles_image, const std::string& name);
86 
87 
88  /** Get a widget visualizing the interest values and extracted interest points.
89  * The interest points will be marked green.
90  * You are responsible for deleting it after usage! */
91  static RangeImageVisualizer* getInterestPointsWidget (const pcl::RangeImage& range_image, const float* interest_image, float min_value, float max_value,
92  const pcl::PointCloud<pcl::InterestPoint>& interest_points, const std::string& name);
93 
94  // =====PUBLIC METHODS=====
95  //! Visualize a range image
96  /* void */
97  /* setRangeImage (const pcl::RangeImage& range_image, */
98  /* float min_value = -std::numeric_limits<float>::infinity (), */
99  /* float max_value = std::numeric_limits<float>::infinity (), */
100  /* bool grayscale = false); */
101 
102  void
103  showRangeImage (const pcl::RangeImage& range_image,
104  float min_value = -std::numeric_limits<float>::infinity (),
105  float max_value = std::numeric_limits<float>::infinity (),
106  bool grayscale = false);
107 
108  protected:
109  // =====PROTECTED MEMBER VARIABLES=====
110  std::string name_;
111  };
112  }
113 }
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:173
RangeImage is derived from pcl/PointCloud and provides functionalities with focus on situations where...
Definition: range_image.h:55
ImageViewer is a class for 2D image visualization.
Definition: image_viewer.h:119
static RangeImageVisualizer * getInterestPointsWidget(const pcl::RangeImage &range_image, const float *interest_image, float min_value, float max_value, const pcl::PointCloud< pcl::InterestPoint > &interest_points, const std::string &name)
Get a widget visualizing the interest values and extracted interest points.
static RangeImageVisualizer * getRangeImageWidget(const pcl::RangeImage &range_image, float min_value, float max_value, bool grayscale, const std::string &name="Range image")
Get a widget visualizing the given range image.
~RangeImageVisualizer() override
Destructor.
void visualizeBorders(const pcl::RangeImage &range_image, float min_value, float max_value, bool grayscale, const pcl::PointCloud< pcl::BorderDescription > &border_descriptions)
Visualize the given range image and the detected borders in it.
void showRangeImage(const pcl::RangeImage &range_image, float min_value=-std::numeric_limits< float >::infinity(), float max_value=std::numeric_limits< float >::infinity(), bool grayscale=false)
Visualize a range image.
static RangeImageVisualizer * getRangeImageBordersWidget(const pcl::RangeImage &range_image, float min_value, float max_value, bool grayscale, const pcl::PointCloud< pcl::BorderDescription > &border_descriptions, const std::string &name="Range image with borders")
Same as above, but returning a new widget.
static RangeImageVisualizer * getHalfAnglesWidget(const pcl::RangeImage &range_image, float *angles_image, const std::string &name)
Get a widget visualizing the given angle image (assuming values in (-PI/2, PI/2]).
RangeImageVisualizer(const std::string &name="Range Image")
Constructor.
static RangeImageVisualizer * getAnglesWidget(const pcl::RangeImage &range_image, float *angles_image, const std::string &name)
Get a widget visualizing the given angle image (assuming values in (-PI, PI]).
#define PCL_EXPORTS
Definition: pcl_macros.h:323