OpenGL C#中的像素检测不适用于高分辨率DPI

问题描述

最近我一直在研究一个机器人,该机器人的工作原理是使用BitBlt捕获OpenGL窗口的窗口捕获,然后在单击它之前在屏幕快照中找到位图。

到目前为止,所有这些功能都可以在我的计算机上使用,但是当我的朋友在他的Alienware 4笔记本电脑上对其进行测试时,这些功能就会中断。

最初,这些屏幕截图并未捕获破坏bot的整个openGL,我发现这是因为我的“程序”不支持DPI,因此我使用

进行了修复
import sys

from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

class Widget(QWidget):
    def __init__(self,*args,**kwargs):
        QWidget.__init__(self,**kwargs)
        hlay = QHBoxLayout(self)
        self.treeview = QTreeView()
        self.listview = QListView()
        hlay.addWidget(self.treeview)
        hlay.addWidget(self.listview)

        path1 = "/mnt/volume1/somedirectory/root1" #QDir.rootPath()
        path2 = '/mnt/volume2/root2'

        self.dirModel = QFileSystemModel()
        self.dirModel.setRootPath(QDir.rootPath())
        self.dirModel.setFilter(QDir.NodotAndDotDot | QDir.AllDirs)

        self.fileModel = QFileSystemModel()
        self.fileModel.setFilter(QDir.NodotAndDotDot |  QDir.Files)

        self.treeview.setModel(self.dirModel)
        self.listview.setModel(self.fileModel)

        self.treeview.setRootIndex(self.dirModel.index(path1))
        self.listview.setRootIndex(self.fileModel.index(path1))

        self.treeview.clicked.connect(self.on_clicked)

    def on_clicked(self,index):
        path1 = self.dirModel.fileInfo(index).absoluteFilePath()
        self.listview.setRootIndex(self.fileModel.setRootPath(path1))


if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = Widget()
    w.show()
    sys.exit(app.exec_())

现在,整个openGL窗口都在他的笔记本电脑上捕获了,但是机器人搜索到的位图没有被识别。

我必须对要查找的位图进行一些缩放吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)