[英]Find new Polygon Coordinates when I already have Old Image Size New Image Size and polygon Coordinates
當我已經將多邊形的舊坐標設置為 [(100,200),(200,300),(300,400),(50,60),(90,100),(400,300)] 並且舊圖像尺寸為 1980x1080 和新圖像時,我想調整它的大小尺寸為 640x480。 如何獲得新的多邊形坐標?
將 x 坐標乘以 640/1980,將 y 坐標乘以 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]))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.