|
@@ -679,7 +679,9 @@ obstructed:
|
|
|
pcl::PointCloud<pcl::PointXYZ>::Ptr in_cloud, //input 输入点云数据
|
|
|
std::vector<int>& leaf_idx
|
|
|
)
|
|
|
- {
|
|
|
+ {
|
|
|
+ //仅用叶子点云数量,有时会出现因叶子误识别(和ror_ratio相关),造成叶子点云数量小,造成误判
|
|
|
+ //所以改成整个空间点云数量做判别--2024-3-2
|
|
|
m_root_center_with_seedling.clear();
|
|
|
m_root_center_with_seedling.assign(m_root_centers.size(), false);
|
|
|
std::vector<int> pcd_cnt;
|
|
@@ -694,13 +696,13 @@ obstructed:
|
|
|
y_min = m_cparam.sc_grab_ymin;
|
|
|
y_max = m_cparam.sc_grab_ymax;
|
|
|
}
|
|
|
- int th_pcd_size = stem_diameter * (y_max - y_min) / m_cloud_mean_dist / m_cloud_mean_dist;
|
|
|
+ int th_pcd_size = 0.333 * stem_diameter * (y_max - y_min) / m_cloud_mean_dist / m_cloud_mean_dist;
|
|
|
std::vector<pcl::PointXYZ> aabb_mins_maxs;
|
|
|
for (int i = 0; i < m_root_centers.size(); ++i) {
|
|
|
CStemResult& rc = m_root_centers.at(i);
|
|
|
pcl::PointXYZ aabb_min;
|
|
|
pcl::PointXYZ aabb_max;
|
|
|
- int cnt = get_point_count_inbox(rc, aabb_min, aabb_max, in_cloud, leaf_idx);
|
|
|
+ int cnt = get_point_count_inbox(rc, aabb_min, aabb_max, in_cloud);
|
|
|
pcd_cnt.push_back(cnt);
|
|
|
bool has_seedling = cnt > th_pcd_size;
|
|
|
m_root_center_with_seedling.at(i) = has_seedling;
|
|
@@ -774,8 +776,8 @@ obstructed:
|
|
|
int CRootStockGrabPoint::get_point_count_inbox(const CStemResult& sr,
|
|
|
pcl::PointXYZ& aabb_min,
|
|
|
pcl::PointXYZ& aabb_max,
|
|
|
- pcl::PointCloud<pcl::PointXYZ>::Ptr in_cloud, //input 输入点云数据
|
|
|
- std::vector<int>& leaf_idx)
|
|
|
+ pcl::PointCloud<pcl::PointXYZ>::Ptr in_cloud //input 输入点云数据
|
|
|
+ )
|
|
|
{
|
|
|
double seedling_distance = m_cparam.rs_grab_seedling_dist;
|
|
|
double min_y = m_cparam.rs_grab_ymin;
|
|
@@ -791,9 +793,7 @@ obstructed:
|
|
|
double max_z = sr.root_z + 0.25 * seedling_distance;
|
|
|
|
|
|
int count = 0;
|
|
|
- //for (auto&pt : m_raw_cloud->points) {
|
|
|
- for (auto&i : leaf_idx) {
|
|
|
- pcl::PointXYZ& pt = in_cloud->points.at(i);
|
|
|
+ for (auto&pt : in_cloud->points) {
|
|
|
if (pt.y >= min_y && pt.y <= max_y &&
|
|
|
pt.x >= min_x && pt.x <= max_x &&
|
|
|
pt.z >= min_z && pt.z <= max_z)
|