没有合适的资源?快使用搜索试试~
我知道了~
收起资源包目录
pythonDXGI截屏.zip
(14个子文件)
pythonDXGI截屏
opencv_world3416.dll
53.23MB
opencv_world451.dll
58.74MB
py3.9
DXGI.pyd
117KB
.idea
workspace.xml
4KB
misc.xml
203B
pythonDXGI截屏.iml
339B
inspectionProfiles
Project_Default.xml
2KB
profiles_settings.xml
174B
modules.xml
291B
.gitignore
50B
cut.py
716B
DXGI.pyd
117KB
py3.8
opencv_world3416.dll
53.23MB
DXGI.pyd
117KB
共 14 条
- 1
import os
import time
os.getcwd()
os.add_dll_directory('H:\pythonDXGI截屏\DXGI.pyd')
from ctypes import windll
import cv2
import numpy as np
windll.winmm.timeBeginPeriod(1)
stop = windll.kernel32.Sleep
import cv2
# 把DXGI.pyd 复制到当前路径
import DXGI
import torch
g = DXGI.capture(0, 0, 320, 320) # 屏幕左上角 到 右下角 (x1, y1 ,x2 ,y2)
while True:
current_time = time.time()
img = g.cap()
img = np.array(img)
# # 将图片转 BGR
img = cv2.cvtColor(img, cv2.COLOR_BGRA2BGR)
last_time=time.time()
time_used = last_time - current_time
print(time_used)
current_time, last_time=0, 0
cv2.imshow('c',img)
cv2.waitKey(1)