{"id":13437935,"url":"https://github.com/halostorm/pointCloud_ground_detection","last_synced_at":"2025-03-19T18:31:17.400Z","repository":{"id":59603917,"uuid":"157512053","full_name":"halostorm/pointCloud_ground_detection","owner":"halostorm","description":null,"archived":false,"fork":false,"pushed_at":"2019-01-03T15:48:28.000Z","size":54167,"stargazers_count":78,"open_issues_count":0,"forks_count":23,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-01T03:25:20.449Z","etag":null,"topics":["ground-detection","pointcloud"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/halostorm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-14T07:57:43.000Z","updated_at":"2024-07-29T10:25:46.000Z","dependencies_parsed_at":"2022-09-18T16:27:51.349Z","dependency_job_id":null,"html_url":"https://github.com/halostorm/pointCloud_ground_detection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halostorm%2FpointCloud_ground_detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halostorm%2FpointCloud_ground_detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halostorm%2FpointCloud_ground_detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halostorm%2FpointCloud_ground_detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halostorm","download_url":"https://codeload.github.com/halostorm/pointCloud_ground_detection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221729762,"owners_count":16871102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ground-detection","pointcloud"],"created_at":"2024-07-31T03:01:01.355Z","updated_at":"2024-10-27T20:30:50.731Z","avatar_url":"https://github.com/halostorm.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"基于线束的地面检测算法(A very efficient ground detection algorithm in 16 lines pointcloud)\n---------------------\ncode文件共4个：\n\n```\n地面检测算法流程：\n１．　点云预处理，提取候选线束\n２．　\"３步\"线束滤波，提取地面线束\n３．　地面分割并计算描述子\n```\n## **I. 点云预处理**\n\n１．点云ringID计算及地面线束截取\n```\n参数：\n#define _lowerBound -15　　\n#define _upperBound 15　　//Lidar垂直方向张角　(-15° ~15 °)\n#define _numOfRings 16　　//基于Lidar线数\n#define _horizontalAngleResolution 0.4 　//水平角分辨率\n\n计算点云ringID：\nfloat angle = std::atan(point.z / sqrt(point.x * point.x + point.y * point.y)) / (1.0f * M_PI) * 180.0f;\nint64 GetScanringID(const float \u0026angle)\n{\n  return static_cast\u003cint64\u003e((angle - _lowerBound)\n　　　 /(1.0f * (_upperBound - _lowerBound)) * (_numOfRings - 1) + 0.5);\n}\n\n设定地面范围为半径30m的圆，对应选择线束0~5作为地面线束。\n```\n２．基准圆设定\n```\n参数：\n#define _basicRadius 6.9 　//基准圆半径\n#define _defaultCurveSize 2000　//每条线束默认点数，超过会自动扩张；设置该参数仅仅为了遍历效率\n#define _curveSizeThreshold 50   　// Curve点数阈值：大于阈值认为是待选曲线\n\n基准圆的半径设定为：第一条线束(半径最小)的半径，根据目前激光的安装方式，半径为6.9ｍ\n```\n原始点云：\n![图片](https://github.com/halostorm/Ground_Detection/blob/master/images/s1.jpg)\n## **II. 第一步：密度滤波**\n\n```\n参数：\n// Density Filter Params\n//密度滤波滤波的作用是去除稀疏的障碍物和线束跳变区域\n#define _srcLenThreshold 0.2　//设定的弧长阈值\n#define _arcNumThreshold 7　//在设定弧长下遍历过的点数　的阈值\n```\n```\n算法细节：\n１．对每一条线束，从头遍历并累计弧长，每当弧长达到设定的弧长阈值_srcLenThreshold\n　（每新加入一个点ｉ，计算弧长时，真实的弧长增量需要通过该点的radius缩放到基准圆，成为等尺度的弧长）\n２．计算遍历过的点数Ｎ，Ｎ\u003e=_arcNumThreshold，则该部分弧保留；反之，滤除点数少的弧.\n\n```\n\n```\n函数：\nvoid PointCloudPlaneCurvesExtract::CurveDensityFilter(\n    const PointXYZRGBNormalCloud \u0026Curve, \n    const int64 ringID, \n    const Uint64Vector \u0026curveId,\n    PointXYZRGBNormalCloud \u0026outCurve\n);\n```\n\n## **II. 第二步：相对半径滤波**\n```\n参数：\n// Radius Filter Params\n//相对半径滤波的作用是去除致密的障碍物，需要讲每条线束划分为Ｎ和扇形区域\n#define _AngleGridResolution 2.0　//　扇形角分辨率\n#define _numOfAngleGrid 180  //   每条弧扇形区域个数　＝　360 / _AngleGridResolution\n#define _radiusScaleThreshold 0.2　//相对半径阈值\n```\n```\n算法细节：\n１．对每一条线束，\n　　(1)从头遍历记录： \n　　　　每个Grid的点\n　　　　每个点对应的角度索引（保存在point.rgba 中）\n　　　　每个点到水平圆点的距离（保存在point.curvature 中）\n　　//注意：这里采用点和Grid双相索引的策略，避免重复查找遍历\n　　(2) 计算每个Grid的半径　＝　所有点到水平原点的距离的均值，若没有点，Grid的半径记为下一条线相同角度Grid的半径\n２．对一条线束m的一个Gridmi 半径为Rmi, 该线束的理想半径为Rm,如果：\n　　      Rmi - Rm-1i \u003e= (Rm - Rm-1)*_radiusScaleThreshold\n         则保留Gridmi,　反之清除Grimi的点。\n //思想：致密障碍物上的线束水平半径相距较近，或部分消失，可以据此滤除这些障碍物\n```\n```\n函数：\nvoid *CurvesRadiusFilter(\n    PointXYZRGBNormalCloud *CurvesVector, \n    const Uint64Vector *CurvesId\n);\n\n```\n密度滤波及相对半径滤波之后：\n![图片](https://github.com/halostorm/Ground_Detection/blob/master/images/s2.jpg)\n\n## **II. 第三步：尺度滤波**\n```\n参数：\n// Size Filter Params\n//找到线束的\"缺口\"作为分割，滤除过短的线段\n#define _breakingDistanceThreshold 0.2　//缺口阈值\n#define _breakingSizeThreshold 30　//线段长度阈值（点数）\n```\n```\n算法细节：\n１．对每一条线束，\n　　(1)从头遍历，查找缺口\n　　(2)计算两个缺口之间的点数，太短则滤除\n```\n```\n函数：\nvoid CurveSizeFilter(\n    const PointXYZRGBNormalCloud \u0026Curve, \n    const int64 ringID, \n    const Uint64Vector \u0026curveId,\n    PointXYZRGBNormalCloud \u0026outCurve\n);\n```\n尺度滤波之后：\n![图片](https://github.com/halostorm/Ground_Detection/blob/master/images/s3.jpg)\n\n## **III. 地面分割/计算描述子**\n\n```\n思想：\n　将地面以2.0°的角分辨率，共６条线束，分为6*180块扇形区域，每块区域根据点数判定是否是地面，是地面则计算描述子\n　//注意：这里地面分割方式与密度滤波中的相同，可以省略大量的重复计算，分割地面时进行Grid索引即可\n分割如下图：\n```\n\n![图片](https://github.com/halostorm/Ground_Detection/blob/master/images/s4.jpg)\n```\n参数：\n// Plane Segment Params\n#define _isGroundPointNumThreshold 3 //扇形区域的点数阈值：需要扇形的两端边缘曲线的点数均满足阈值条件\n#define _ransacDistanceThreshold 0.03　//扇形区域平面拟合　RANSAC算法距离误差阈值\n```\n\n```\n描述子：\nstruct Sentor\n{\n  bool isGround;　//是否地面\n  int conf[2]; 　// conf[0] ：后边缘曲线的点数　；　conf[1] ：前边缘曲线的点数　\n  float smooth; //平滑度\n  float radiusEdge[2];　//radiusEdge[0] ：后边缘曲线的半径　；radiusEdge[1] ：前边缘曲线的半径　\n  Eigen::VectorXf planeParams;　//该扇形区域的平面参数\n  PointXYZRGBNormalCloud oneLinePoints;　//后边缘曲线的点集\n  PointXYZRGBNormalCloud twoLinePoints;　//前后边缘曲线的点集和\n};\n```\n\n```\n具体描述子的计算：\n函数：\nvoid PlaneSegment(\n    const PointCloudPlaneCurvesExtract *pcpce\n);\n```\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalostorm%2FpointCloud_ground_detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalostorm%2FpointCloud_ground_detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalostorm%2FpointCloud_ground_detection/lists"}