当我已经拥有旧的图像大小新图像大小和多边形坐标时,找到新的多边形坐标

发布于 2025-02-11 14:06:19 字数 139 浏览 0 评论 0原文

当我已经拥有旧坐标时,我想调整多边形大小,为[(100,200),(200,300),(300,400),(50,60),(90,100),(90,100),(400,300)],旧图像大小为1980x1080和新图像尺寸为640x480。如何获得多边形的新坐标?

I want to resize a polygon when I already have it's old coordinate as [(100,200),(200,300),(300,400),(50,60),(90,100),(400,300)] and old Image size is 1980x1080 and new image size is 640x480. How can I get new Coordinates of Polygon?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九命猫 2025-02-18 14:06:19

将X坐标乘以640/1980,将Y-Coordine乘以480/1080。

由于您标记了numpy

import numpy as np

old_polygon = np.array([(100,200),(200,300),(300,400),(50,60),(90,100),(400,300)])
new_polygon = old_polygon * (np.array([640, 480]) / np.array([1980, 1080]))

Multiply the x-coordinates by 640/1980 and the y-coordinates by 480/1080.

Since you tagged numpy:

import numpy as np

old_polygon = np.array([(100,200),(200,300),(300,400),(50,60),(90,100),(400,300)])
new_polygon = old_polygon * (np.array([640, 480]) / np.array([1980, 1080]))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文