00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include <pcl/pcl_config.h>
00036
00037 #include <pcl/visualization/range_image_visualizer.h>
00038
00039 pcl::visualization::RangeImageVisualizer::RangeImageVisualizer (const std::string& name) : ImageViewer (name), name_ ()
00040 {
00041 }
00042
00043 pcl::visualization::RangeImageVisualizer::~RangeImageVisualizer ()
00044 {
00045 }
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 void
00057 pcl::visualization::RangeImageVisualizer::showRangeImage (const pcl::RangeImage& range_image, float min_value, float max_value, bool grayscale)
00058 {
00059 float* ranges = range_image.getRangesArray ();
00060 showFloatImage(ranges, range_image.width, range_image.height, min_value, max_value, grayscale);
00061
00062 delete[] ranges;
00063 }
00064
00065 pcl::visualization::RangeImageVisualizer*
00066 pcl::visualization::RangeImageVisualizer::getRangeImageWidget (
00067 const pcl::RangeImage& range_image, float min_value, float max_value, bool grayscale, const std::string& name)
00068 {
00069 RangeImageVisualizer* range_image_widget = new RangeImageVisualizer (name);
00070 range_image_widget->showRangeImage (range_image, min_value, max_value, grayscale);
00071 return range_image_widget;
00072 }
00073
00074 void
00075 pcl::visualization::RangeImageVisualizer::visualizeBorders (
00076 const pcl::RangeImage& range_image, float min_value, float max_value, bool grayscale,
00077 const pcl::PointCloud<pcl::BorderDescription>& border_descriptions)
00078 {
00079 showRangeImage(range_image, min_value, max_value, grayscale);
00080 for (size_t y=0; y<range_image.height; ++y)
00081 {
00082 for (size_t x=0; x<range_image.width; ++x)
00083 {
00084 const pcl::BorderDescription& border_description = border_descriptions.points[y*range_image.width + x];
00085 const pcl::BorderTraits& border_traits = border_description.traits;
00086 if (border_traits[pcl::BORDER_TRAIT__OBSTACLE_BORDER])
00087 {
00088 markPoint (x, y, green_color);
00089
00090
00091
00092 }
00093 else if (border_traits[pcl::BORDER_TRAIT__SHADOW_BORDER])
00094 markPoint(x, y, blue_color);
00095 else if (border_traits[pcl::BORDER_TRAIT__VEIL_POINT])
00096 markPoint(x, y, red_color);
00097 }
00098 }
00099 }
00100
00101 pcl::visualization::RangeImageVisualizer*
00102 pcl::visualization::RangeImageVisualizer::getRangeImageBordersWidget (
00103 const pcl::RangeImage& range_image, float min_value, float max_value, bool grayscale,
00104 const pcl::PointCloud<pcl::BorderDescription>& border_descriptions, const std::string& name)
00105 {
00106
00107 RangeImageVisualizer* range_image_widget = new RangeImageVisualizer;
00108 range_image_widget->visualizeBorders (range_image, min_value, max_value, grayscale,
00109 border_descriptions);
00110 range_image_widget->setWindowTitle (name);
00111 return range_image_widget;
00112 }
00113
00114 pcl::visualization::RangeImageVisualizer*
00115 pcl::visualization::RangeImageVisualizer::getAnglesWidget (const pcl::RangeImage& range_image, float* angles_image,
00116 const std::string& name)
00117 {
00118 RangeImageVisualizer* widget = new RangeImageVisualizer;
00119 widget->showAngleImage(angles_image, range_image.width, range_image.height);
00120 widget->setWindowTitle (name);
00121 return widget;
00122 }
00123
00124 pcl::visualization::RangeImageVisualizer*
00125 pcl::visualization::RangeImageVisualizer::getHalfAnglesWidget (const pcl::RangeImage& range_image,
00126 float* angles_image, const std::string& name)
00127 {
00128 RangeImageVisualizer* widget = new RangeImageVisualizer;
00129 widget->showHalfAngleImage(angles_image, range_image.width, range_image.height);
00130 widget->setWindowTitle (name);
00131 return widget;
00132 }
00133
00134 pcl::visualization::RangeImageVisualizer*
00135 pcl::visualization::RangeImageVisualizer::getInterestPointsWidget (
00136 const pcl::RangeImage& range_image, const float* interest_image, float min_value, float max_value,
00137 const pcl::PointCloud<pcl::InterestPoint>& interest_points, const std::string& name)
00138 {
00139 RangeImageVisualizer* widget = new RangeImageVisualizer;
00140 widget->showFloatImage (interest_image, range_image.width, range_image.height, min_value, max_value);
00141 widget->setWindowTitle (name);
00142 for (unsigned int i=0; i<interest_points.points.size(); ++i)
00143 {
00144 const pcl::InterestPoint& interest_point = interest_points.points[i];
00145 float image_x, image_y;
00146 range_image.getImagePoint (interest_point.x, interest_point.y, interest_point.z, image_x, image_y);
00147 widget->markPoint (static_cast<size_t> (image_x), static_cast<size_t> (image_y), green_color, red_color);
00148
00149 }
00150 return widget;
00151 }