Go to the documentation of this file.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 <ias_descriptors_3d/bounding_box_raw.h>
00036
00037 using namespace std;
00038
00039
00040
00041
00042 BoundingBoxRaw::BoundingBoxRaw(double bbox_radius)
00043 {
00044 result_size_ = 3;
00045 result_size_defined_ = true;
00046
00047 neighborhood_radius_ = bbox_radius;
00048 neighborhood_radius_defined_ = true;
00049 }
00050
00051
00052
00053
00054
00055
00056 void BoundingBoxRaw::clearShared()
00057 {
00058 }
00059
00060
00061
00062
00063 std::string BoundingBoxRaw::getName() const
00064 {
00065 ostringstream oss;
00066 oss << "BoundingBoxRaw_radius" << neighborhood_radius_;
00067 return oss.str();
00068 }
00069
00070
00071
00072
00073
00074 int BoundingBoxRaw::precompute(const sensor_msgs::PointCloud& data,
00075 cloud_kdtree::KdTree& data_kdtree,
00076 const std::vector<const geometry_msgs::Point32*>& interest_pts)
00077 {
00078 return 0;
00079 }
00080
00081
00082
00083
00084 int BoundingBoxRaw::precompute(const sensor_msgs::PointCloud& data,
00085 cloud_kdtree::KdTree& data_kdtree,
00086 const std::vector<const std::vector<int>*>& interest_region_indices)
00087 {
00088 return 0;
00089 }
00090
00091
00092
00093
00094 void BoundingBoxRaw::computeNeighborhoodFeature(const sensor_msgs::PointCloud& data,
00095 const vector<int>& neighbor_indices,
00096 const unsigned int interest_sample_idx,
00097 std::vector<float>& result) const
00098 {
00099 result.resize(result_size_);
00100 const unsigned int nbr_neighbors = neighbor_indices.size();
00101
00102
00103
00104
00105 if (nbr_neighbors == 0)
00106 {
00107 ROS_INFO("BoundingBoxRaw::computeNeighborhoodFeature() No points to form bounding box");
00108 for (size_t i = 0 ; i < result_size_ ; i++)
00109 {
00110 result[i] = 0.0;
00111 }
00112 return;
00113 }
00114
00115
00116
00117 const geometry_msgs::Point32& first_point = data.points.at(neighbor_indices[0]);
00118 float min_x = first_point.x;
00119 float min_y = first_point.y;
00120 float min_z = first_point.z;
00121 float max_x = min_x;
00122 float max_y = min_y;
00123 float max_z = min_z;
00124
00125
00126
00127 for (unsigned int i = 1 ; i < nbr_neighbors ; i++)
00128 {
00129 const geometry_msgs::Point32& curr_pt = data.points.at(neighbor_indices[i]);
00130
00131
00132 float curr_coord = curr_pt.x;
00133 if (curr_coord < min_x)
00134 {
00135 min_x = curr_coord;
00136 }
00137 if (curr_coord > max_x)
00138 {
00139 max_x = curr_coord;
00140 }
00141
00142
00143 curr_coord = curr_pt.y;
00144 if (curr_coord < min_y)
00145 {
00146 min_y = curr_coord;
00147 }
00148 if (curr_coord > max_y)
00149 {
00150 max_y = curr_coord;
00151 }
00152
00153
00154 curr_coord = curr_pt.z;
00155 if (curr_coord < min_z)
00156 {
00157 min_z = curr_coord;
00158 }
00159 if (curr_coord > max_z)
00160 {
00161 max_z = curr_coord;
00162 }
00163 }
00164
00165
00166 result[0] = max_x - min_x;
00167 result[1] = max_y - min_y;
00168 result[2] = max_z - min_z;
00169 }