Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

坐标识别错误 #154

Open
ArsenicX opened this issue Jun 18, 2022 · 7 comments
Open

坐标识别错误 #154

ArsenicX opened this issue Jun 18, 2022 · 7 comments

Comments

@ArsenicX
Copy link

系统:intel Mac & 未越狱 iPhone

依照 readme 设置了 ocr_range,分别是 [x1,y1,x2,y2],但是一直提示
rect (1293.0, 1243.0, -50.0, -33.0) does not intersect any displays 发生了一点小问题:("cannot identify image file '/var/folders/.../tmpjmdofo2j.png'",)
查看了目录发现这些文件都是0kb,如下图:
WX20220618-194526@2x.png

可是我设置的 ocr_range 并不是负数啊....我还尝试了其他坐标,发现他总会读取错误
我尝试设置的[1234,2234,3234,4234],但是报错会提示rect (1234.0, 3234.0, 2000.0, 2000.0) does not intersect any displays
都不知道怎么设置坐标了😭

@yqchilde
Copy link
Owner

mac使用 snipaste 截图工具截图,屏幕左上角为原点,且mac屏幕分辨率高,一般做四个坐标都乘以2来算

@ArsenicX
Copy link
Author

mac使用 snipaste 截图工具截图,屏幕左上角为原点,且mac屏幕分辨率高,一般做四个坐标都乘以2来算

左上角?是左下角吧

我以左下角为基点又试了一遍:
用截图工具测到的位置是:[1266,924,1315,906]
您说乘2来算,那就是ocr_range: [2532,1848,2630,1812]
结果还是报错:rect (2532.0, 2630.0, 98.0, -36.0) does not intersect any displays

第一个坐标是对应的,但第二个坐标是第三个的坐标,第三个和第四个我甚至都不知道是怎么来的....

@yqchilde
Copy link
Owner

1655608570400

如图,左上角作为原点,前提是要用对截图工具,比如QQ的截图工具就是以左下角为原点

@ArsenicX
Copy link
Author

我下载了snipaste,以左上角位原点,还是同样的问题。
实在是不清楚这个定位是怎么偏移的
WeChat019c8748fd9a2b758a2cb5f56b3ae65a.png

我也懒得折腾了,随便定了个位置,然后反过来移动 iMessage 窗口去对位置曲线救国了😂

@fakebri
Copy link

fakebri commented Jul 1, 2022

应该是依赖问题,Pillow截取指令的代码写错了,我之前也遇到了,看这个python-pillow/Pillow@9fb0087 ,修改或者更新一下依赖就正常了。

@fakebri
Copy link

fakebri commented Jul 1, 2022

坐标也不需要乘2,在我13寸的MacBook Pro上直接用Command+Shift+4自带的截取工具就可以截取坐标,没必要再安装第三方截图工具。

@AkiraLan
Copy link

是这样的……测试了很多方法,最后都获取不到正确的截图,试了试更新pillow好了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants