27 const SppParams& param,
const std::string& sensor_name) {
29 detector_2d_cc_.
Init(
static_cast<int>(height),
static_cast<int>(width));
31 static_cast<float>(height) / (2.f * range),
34 labels_2d_.
Init(width, height, sensor_name);
54size_t SppEngine::ProcessConnectedComponentCluster(
59 double sync_time1 = timer.
toc(
true);
61 size_t num = detector_2d_cc_.
Detect(&labels_2d_);
63 ADEBUG <<
"No object detected";
66 double detect_time = timer.
toc(
true);
68 double sync_time2 = timer.
toc(
true);
76 double filter_time = timer.
toc(
true);
83 if (data_.
z_data !=
nullptr) {
87 double chz_time = timer.
toc(
true);
91 clusters_ = labels_2d_;
92 for (
size_t i = 0; i < point_cloud->size(); ++i) {
93 if (mask.
size() && mask[
static_cast<int>(i)] == 0) {
101 const auto& point = point_cloud->at(i);
102 const uint16_t& label = labels_2d_[0][id];
108 clusters_.
AddPointSample(label - 1, point, point_cloud->points_height(i),
109 static_cast<uint32_t
>(i));
112 double mapping_time = timer.
toc(
true);
115 double remove_time = timer.
toc(
true);
117 AINFO <<
"SegForeground: sync1 " << sync_time1 <<
"\tdetect: " << detect_time
118 <<
"\tsync2: " << sync_time2 <<
"\tfilter: " << filter_time
119 <<
"\tchz: " << chz_time <<
"\tmapping: " << mapping_time
120 <<
"\tremove: " << remove_time;
122 return clusters_.
size();
128 ProcessConnectedComponentCluster(point_cloud, mask_);
129 AINFO <<
"Foreground: " << clusters_.
size() <<
" clusters";
130 return clusters_.
size();
137 mask_.
Set(full_point_cloud->size(), 0);
142 for (
size_t i = 0; i < clusters_.
size(); ++i) {
143 clusters_[
static_cast<int>(i)]->RemovePoints(mask_);
146 return clusters_.
size();
const Dtype * cpu_data() const
void Bind(const std::function< bool()> &func)
void AddIndices(const base::PointIndices &indices, int value=1)
void Set(size_t size, int init_value)
void RemoveIndicesOfIndices(const base::PointIndices &indices, const base::PointIndices &indices_of_indices)
void SetData(const float *const *prob_map, const float *offset_map, float scale, float objectness_threshold)
size_t Detect(SppLabelImage *labels)
void Init(int rows, int cols)
void AddPointSample(size_t cluster_id, const base::PointF &point, float height, uint32_t point_id)
void RemoveEmptyClusters()
void Init(size_t width, size_t height, float range, const SppParams ¶m=SppParams(), const std::string &sensor_name="velodyne64")
size_t RemoveGroundPointsInForegroundCluster(const base::PointFCloudConstPtr full_point_cloud, const base::PointIndices &roi_indices, const base::PointIndices &roi_non_ground_indices)
size_t ProcessForegroundSegmentation(const base::PointFCloudConstPtr point_cloud)
void CalculateClusterTopZ(const float *top_z_map)
SppClusterPtr GetCluster(size_t id)
void CalculateClusterClass(const float *class_map, size_t class_num)
void CalculateClusterHeading(const float *heading_map)
void Init(size_t width, size_t height, const std::string &sensor_name="velodyne64")
void FilterClusters(const float *confidence_map, float threshold)
void InitRangeMask(float range, float boundary_distance)
double toc(bool reset=false)
std::shared_ptr< const PointFCloud > PointFCloudConstPtr
float confidence_threshold
base::Blob< float > * category_pt_blob
float objectness_threshold
base::Blob< float > * instance_pt_blob
float ** obs_prob_data_ref
base::Blob< float > * heading_pt_blob
base::Blob< float > * classify_pt_blob
base::Blob< float > * height_pt_blob
base::Blob< float > * confidence_pt_blob