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
00039 #include <pcl_visualization/range_image_visualizer.h>
00040
00041 pcl_visualization::RangeImageVisualizer::RangeImageVisualizer (const std::string& name) : ImageWidgetWX (), name_ (name)
00042 {
00043 }
00044
00045 pcl_visualization::RangeImageVisualizer::~RangeImageVisualizer ()
00046 {
00047 }
00048
00049 void
00050 pcl_visualization::RangeImageVisualizer::setRangeImage (const pcl::RangeImage& range_image, float min_value, float max_value, bool grayscale)
00051 {
00052
00053
00054 float* ranges = range_image.getRangesArray ();
00055
00056
00057 setFloatImage (ranges, range_image.width, range_image.height, name_.c_str (), min_value, max_value, grayscale);
00058 delete[] ranges;
00059 }
00060
00061 pcl_visualization::RangeImageVisualizer*
00062 pcl_visualization::RangeImageVisualizer::getRangeImageWidget (
00063 const pcl::RangeImage& range_image, float min_value, float max_value, bool grayscale, const std::string& name)
00064 {
00065 RangeImageVisualizer* range_image_widget = new RangeImageVisualizer (name);
00066 range_image_widget->setRangeImage (range_image, min_value, max_value, grayscale);
00067 return range_image_widget;
00068 }
00069
00070 void pcl_visualization::RangeImageVisualizer::visualizeBorders (
00071 const pcl::RangeImage& range_image, float min_value, float max_value, bool grayscale,
00072 const pcl::PointCloud<pcl::BorderDescription>& border_descriptions)
00073 {
00074 setRangeImage(range_image, min_value, max_value, grayscale);
00075
00076 for (int y=0; y<(int)range_image.height; ++y)
00077 {
00078 for (int x=0; x<(int)range_image.width; ++x)
00079 {
00080 const pcl::BorderDescription& border_description = border_descriptions.points[y*range_image.width + x];
00081 const pcl::BorderTraits& border_traits = border_description.traits;
00082 if (border_traits[pcl::BORDER_TRAIT__OBSTACLE_BORDER])
00083 {
00084 markPoint (x, y, wxGREEN_PEN);
00085
00086
00087
00088 }
00089 else if (border_traits[pcl::BORDER_TRAIT__SHADOW_BORDER])
00090 markPoint(x, y, wxCYAN_PEN);
00091 else if (border_traits[pcl::BORDER_TRAIT__VEIL_POINT])
00092 markPoint(x, y, wxRED_PEN);
00093 }
00094 }
00095 }
00096
00097 pcl_visualization::RangeImageVisualizer*
00098 pcl_visualization::RangeImageVisualizer::getRangeImageBordersWidget (
00099 const pcl::RangeImage& range_image, float min_value, float max_value, bool grayscale,
00100 const pcl::PointCloud<pcl::BorderDescription>& border_descriptions, const std::string& name)
00101 {
00102
00103 RangeImageVisualizer* range_image_widget = new RangeImageVisualizer;
00104 range_image_widget->visualizeBorders (range_image, min_value, max_value, grayscale,
00105 border_descriptions);
00106 range_image_widget->setName (name);
00107 return range_image_widget;
00108 }
00109
00110 pcl_visualization::RangeImageVisualizer*
00111 pcl_visualization::RangeImageVisualizer::getAnglesWidget (const pcl::RangeImage& range_image, float* angles_image,
00112 const std::string& name)
00113 {
00114 RangeImageVisualizer* widget = new RangeImageVisualizer;
00115 widget->setAngleImage(angles_image, range_image.width, range_image.height, name.c_str());
00116 return widget;
00117 }
00118
00119 pcl_visualization::RangeImageVisualizer*
00120 pcl_visualization::RangeImageVisualizer::getHalfAnglesWidget (const pcl::RangeImage& range_image,
00121 float* angles_image, const std::string& name)
00122 {
00123 RangeImageVisualizer* widget = new RangeImageVisualizer;
00124 widget->setHalfAngleImage(angles_image, range_image.width, range_image.height, name.c_str());
00125 return widget;
00126 }
00127
00128 pcl_visualization::RangeImageVisualizer*
00129 pcl_visualization::RangeImageVisualizer::getInterestPointsWidget (
00130 const pcl::RangeImage& range_image, float* interest_image, float min_value, float max_value,
00131 const pcl::PointCloud<pcl::InterestPoint>& interest_points, const std::string& name)
00132 {
00133 RangeImageVisualizer* widget = new RangeImageVisualizer;
00134 widget->setFloatImage (interest_image, range_image.width, range_image.height, name.c_str (), min_value, max_value);
00135 for (unsigned int i=0; i<interest_points.points.size(); ++i)
00136 {
00137 const pcl::InterestPoint& interest_point = interest_points.points[i];
00138 float image_x, image_y;
00139 range_image.getImagePoint (interest_point.x, interest_point.y, interest_point.z, image_x, image_y);
00140 widget->markPoint (image_x, image_y, wxGREEN_PEN, wxRED_BRUSH);
00141
00142 }
00143 return widget;
00144 }