Desc: 将点分类到相应的cluster中, 使得cluster的边界满足width阈值 Args: points : 需要分类的Point集合 clusters : list of cluster, cluster 可能会被修改, 增加一些新的point width : 类的宽度阈值 Return: [p3, p4, p5, ...], 无法分到cluster的所有点 Raises: None
(points, clusters, width=40)
| 42 | |
| 43 | |
| 44 | def rect_classify(points, clusters, width=40): |
| 45 | """ |
| 46 | Desc: 将点分类到相应的cluster中, 使得cluster的边界满足width阈值 |
| 47 | |
| 48 | Args: |
| 49 | points : 需要分类的Point集合 |
| 50 | |
| 51 | clusters : list of cluster, cluster 可能会被修改, 增加一些新的point |
| 52 | |
| 53 | width : 类的宽度阈值 |
| 54 | Return: |
| 55 | [p3, p4, p5, ...], 无法分到cluster的所有点 |
| 56 | Raises: |
| 57 | None |
| 58 | """ |
| 59 | alg = cluster.Classifier(clusters, width) |
| 60 | return alg.run(points) |
| 61 | |
| 62 | |
| 63 | def region_filter(regions, grid_size=1024, thread_num=4): |