首页 > 解决方案 > Python - Find Coordinates Relative to Screen

问题描述

Hi I'm not really sure how to phrase this question but basically,

S

x1: 575, y1: 76, x2: 1585, y2: 780 is the window position on my screen which is 1920x1080

The smaller box in the window, x1: 539, y1: 257, x2: 752, y2: 498 is relative to the window which is the above coordinates

I'm trying to calculate the x1, y1, x2, y2 of the smaller box relative to my screen 1920x1080.

It's more of a maths problem and i'm completely lost on how to do this haha e_e

Expected answer is : x1: 1120, y1: 337, x2: 1333, y2: 574 +- a bit of offset because all of the above values and this expected values are measured in paint on my PC haha e_e

Please help any of you maths wiz out there! :(

标签: pythonimagecoordinatesboxbounding-box

解决方案


这是一道数学题,你是对的。

absolutex1 = outerx1 + innerx1
absolutey1 = outery1 + innery1
absolutex2 = outerx1 + innerx2
absolutey2 = outery1 + innery2

查看内部时,它仅与外部 x1,y1 相关。


推荐阅读