![]() | 1 Latin 2020-06-05 17:00:36 +08:00 绘制多边形啊 |
![]() | 2 sivacohan PRO python cv2 图像就是一个二维数组,你就是检查数组里面某个特征点是否落在指定的 Index 范围。 |
![]() | 3 Latin 2020-06-05 17:07:42 +08:00 判断点是否在多边形区域内的方法 https://paste.ubuntu.com/p/dbPJBCcf7j/ |
![]() | 4 MLLB 200-06-05 17:16:09 +08:00 numpy.array |
![]() | 5 U7Q5tLAex2FI0o0g 2020-06-05 17:22:35 +08:00 针对凸多边形,任意形状,任意边数,只需要知道连续的顶点的坐标,[x0,y0],[x1,y1]...[xn,yn] 对任意点[x,y],有一套算法可以得出[x,y]是否在多边形范围内 |
6 arrow8899 2020-06-05 17:26:36 +08:00 point in polygon 问题,github 上搜一大把 https://www.algorithms-and-technologies.com/point_in_polygon/ 不过要注意一些特殊情况,比如点重合,点在边上等,然后结合需求修改代码。 |
![]() | 7 RealMadrid 2020-06-06 08:07:31 +08:00 用 python 的话,可以用 matplotlib 里面 path,来判断点是否在一个多边形里 from matplotlib import path def is_point_in_polygon(point, polygon): p = path.Path(polygon) return p.contains_point(point) |
8 qile1 2020-06-06 10:14:25 +08:00 via Android 图像转为坐标点,然后判断两次 x 和 y 是否大于最大值是不是就可以,这个点你如何获取? |
9 qile1 2020-06-06 10:39:55 +08:00 via Android t/674900#; 楼上几位大佬能不能帮看看我这个问题,谢谢 |
10 aguesuka 2020-06-06 15:29:47 +08:00 这是个很大的问题,计算机图形学的核心问题之一 |
![]() | 11 tblxdezhu 2020-06-07 21:27:28 +08:00 楼上的都不知道这个库吗? Shapely,实例化 Point 文档在此: https://shapely.readthedocs.io/en/latest/manual.html |
![]() | 12 necomancer 2020-06-08 10:29:45 +08:00 1. 获取区域 pointcloud 的坐标,这个想办法,或者找现成工具例如 datathief; 2. 用 scipy 的 convex hull 模块生成 hull = convexhull(pointcloud); 3. 判断使用 point_in_hull = np.allclose([p.dot(_[:-1]) for _ in hull.equations],0) 如果不是用 Point cloud 表示一个奇怪的形状,而是有方程描述,直接用方程。尤其对形状有线性方程描述,直接使用上述的 3 就可以了。 |
![]() | 13 necomancer 2020-06-08 10:34:36 +08:00 不是数据坐标的话,就用像素坐标 |
![]() | 14 necomancer 2020-06-08 10:43:27 +08:00 我弄错了一个地方……sorry,应该是 np.all(hull.equations[:,:-1].dot(p) + hull.equations.T[-1] < 0) The convex hull of a point set P is the smallest convex set that contains P. If P is finite, the convex hull defines a matrix A and a vector b such that for all x in P, Ax+b <= [0,...]. Qhull 的文档,我给搞成等于 0 了。 |
![]() | 15 necomancer 2020-06-08 10:53:37 +08:00 np.all(np.less_equal(np.einsum('ij,...j->...i', hull.equations[:,:-1], <array(N_points, N_dimension)>) + hull.equations.T[-1], 0), axis=-1),可以做批量判断,numpy 的处理比 for 循环快很多。 |