Python/Opencv - 如何找到多边形的左下顶点
早上好,
我是 OpenCV 和 numpy 的新手,我正在尝试找到一种方法来获取多边形的一个顶点。我需要提取形状的左下顶点。
我将多边形作为无序的 numpy 数组获取,假设
[[348 778]
[313 856]
[200 621]
[235 558]]
我需要找到左下顶点,如图所示
我应该选择 [778, 348]
有没有办法获取这个顶点?
Good morning,
i'm new to OpenCV and numpy and i'm trying to find a way to get one of the vertex of a polygon. I need to extract che bottom left vertex of the shape.
I get the polygon as a not ordered numpy array, let's say
[[348 778]
[313 856]
[200 621]
[235 558]]
i need to find the bottom left vertex, as in the image
i should select [778, 348]
Is there a way to get this vertex?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要获得左下点,您应该获得 y 值最大的两个点,它们代表底部。然后,你应该得到对应x最低的点,它代表左下角的点。使用 [y,x] 中表示的点,您可以使用以下代码:
To get your lower-left point, you should get the two points with the greatest y values, which represent the bottom. Then, you should get the point with the lowest corresponding x, which represents the point in the bottom left. Using your points that are represented in [y,x], you can use the following code: