Skip to content

Version 1.0 - Faster DXcam !!!

Compare
Choose a tag to compare
@AI-M-BOT AI-M-BOT released this 31 Mar 18:45
· 24 commits to main since this release
fc0a257

Compiled version of dxcam for Python 3.7/3.8/3.9/3.10
Usage is simple, replace all dxcam with dxshot, enjoy 😁

import time
import dxshot
import cv2


shape = 640
left, top = (1920 - shape) // 2, (1080 - shape) // 2
right, bottom = left + shape, top + shape
region = (left, top, right, bottom)
title = "[DXcam] FPS benchmark"
cam = dxshot.create()
start_time = time.perf_counter()

fps = 0


while fps < 1000:
    start = time.perf_counter()
    frame = cam.grab(region=region)
    if frame is not None:
        # now_time = time.perf_counter()
        # print(now_time-start)
        # start = now_time
        fps += 1
        # cv2.imshow('', frame)
        # cv2.waitKey(1)

end_time = time.perf_counter() - start_time

print(f"{title}: {fps/end_time}")
del cam