59 return static_cast<int>(_segment_pids.size());
68 return _segment_labels[sid];
78 void GetSegmentSize(
int sid,
float* length,
float* width,
float* height)
const {
79 NcutBoundingBox box = _segment_bbox[sid];
80 *length = std::get<1>(box) - std::get<0>(box);
81 *width = std::get<3>(box) - std::get<2>(box);
82 *height = std::get<5>(box) - std::get<4>(box);
125 typedef std::tuple<float, float, float, float, float, float> NcutBoundingBox;
129 float _super_pixel_cell_size;
130 std::unique_ptr<LRClassifier> _classifier;
132 double _felzenszwalb_sigma;
133 double _felzenszwalb_k;
134 int _felzenszwalb_min_size;
136 double _sigma_feature;
138 double _connect_radius;
140 float _ncuts_stop_threshold;
141 double _ncuts_enable_classifier_threshold;
143 std::vector<std::vector<int>> _cluster_points;
145 std::vector<NcutBoundingBox> _cluster_bounding_box;
146 std::vector<std::string> _cluster_labels;
148 float _skeleton_cell_size;
150 cv::Mat _cv_feature_map;
151 FloodFill _ff_feature_grid;
152 std::vector<Eigen::MatrixXf> _cluster_skeleton_points;
153 std::vector<Eigen::MatrixXf> _cluster_skeleton_features;
155 double _overlap_factor;
157 std::vector<std::vector<int>> _segment_pids;
158 std::vector<std::string> _segment_labels;
159 std::vector<NcutBoundingBox> _segment_bbox;
160 std::vector<std::vector<int>> _outlier_pids;
163 const std::vector<int>& point_gids,
164 Eigen::MatrixXf* skeleton_coords,
165 Eigen::MatrixXf* skeleton_feature);
167 void PrecomputeAllSkeletonAndBbox();
169 bool Configure(
const NCutParam& ncut_param_);
171 void SuperPixelsFloodFill(
175 std::vector<std::vector<int>>* super_pixels);
178 void BuildAverageHeightMap(
180 const FloodFill& ff_map,
181 cv::Mat* cv_height_map,
182 std::vector<gridIndex>* point_pixel_indices);
185 void GetPatchFeature(
const Eigen::MatrixXf& points, Eigen::MatrixXf* features);
188 NcutBoundingBox ComputeClusterBoundingBox(
const std::vector<int>& point_gids);
193 float ncuts_threshold,
195 std::vector<std::vector<int>>* segment_clusters,
196 std::vector<std::string>* segment_labels);
198 void ComputeSkeletonWeights(Eigen::MatrixXf* weights);
201 const Eigen::MatrixXf& in_weights,
202 const std::vector<int>* in_clusters,
203 std::vector<int>* seg1,
204 std::vector<int>* seg2);
206 void LaplacianDecomposition(
const Eigen::MatrixXf& weights, Eigen::MatrixXf* eigenvectors);
208 bool ComputeSquaredSkeletonDistance(
209 const Eigen::MatrixXf& in1_points,
210 const Eigen::MatrixXf& in1_features,
211 const Eigen::MatrixXf& in2_points,
212 const Eigen::MatrixXf& in2_features,
214 float* dist_feature);
216 bool IsMovableObstacle(
const std::vector<int>& cluster_ids, std::string* label);
218 inline bool IsPotentialPedestrianSize(
float length,
float width) {
219 return ((length > 0.5 && length < 1.5) && (width > 0.3 && width < 1));
222 inline bool IsPotentialBicyclistSize(
float length,
float width) {
223 return ((length > 1 && length < 2.5) && (width > 0.3 && width < 1.5));
226 inline bool IsPotentialCarSize(
float length,
float width) {
229 return ((length > 1.0 && length < 8.0) && (width > 1.0 && width < 3.5));
232 int GetComponentBoundingBox(
const std::vector<int>& cluster_ids, NcutBoundingBox* box);
234 inline float GetBboxLength(
const NcutBoundingBox& box) {
235 return (std::get<1>(box) - std::get<0>(box));
238 inline float GetBboxWidth(
const NcutBoundingBox& box) {
239 return (std::get<3>(box) - std::get<2>(box));
242 inline float GetBboxHeight(
const NcutBoundingBox& box) {
243 return (std::get<5>(box) - std::get<4>(box));
246 std::string GetClustersLabel(
const std::vector<int>& cluster_ids);
248 void GetClustersPids(
const std::vector<int>& cids, std::vector<int>* pids);