opencv桌面捕获以大字体模式仅返回Windows屏幕的一部分

时间:2018-07-20 16:03:51

标签: c++ opencv winapi gdi

我使用此标准示例通过opencv抓屏。如果我在控制面板中的字体大小为100%,它将正常工作:

import xlwings as xw
wb = xw.Book()  # this will create a new workbook
wb = xw.Book('FileName.xlsx')  # connect to an existing file in the current working directory
wb = xw.Book(r'C:\path\to\file.xlsx')  # on Windows: use raw strings to escape backslashes
app = xw.App()  # or something like xw.apps[0] for existing apps
wb = app.books['Book1']

但是,如果我启用大字体(至少在Windows 10上启用),那么它只会给我屏幕的左上角:

enter image description here

我该如何解决?

2 个答案:

答案 0 :(得分:2)

我认为您需要通过创建corresponding manifest entry将应用程序标记为支持HighDpi。否则,您的应用程序将处理DPI虚拟化。

答案 1 :(得分:0)

另一个解决方案可能是在程序的开头调用SetProcessDPIAware()。帮助了我。