-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
classic theme increased performance on x5-x7 #223
Comments
windows 10 doesn't have classic theme |
My naive guess would be that Aero is using a lot of blur, and so there are less way to compress pixels. It would be interesting to track the MSS code to see where the time is spent. |
right now im using this code. its a little faster than mss on my requestions. self.hwnd = win32gui.FindWindow(None, self.window_name)
def _screenshot_win(self): # cpu_avg 2.8 on 50ms sleep | 1.4 on 100ms | 1.15 on 100ms with openCV cvtColor
# get the window image data
wDC = win32gui.GetWindowDC(self.hwnd)
dcObj = win32ui.CreateDCFromHandle(wDC)
cDC = dcObj.CreateCompatibleDC()
dataBitMap = win32ui.CreateBitmap()
dataBitMap.CreateCompatibleBitmap(dcObj, self.w, self.h)
cDC.SelectObject(dataBitMap)
cDC.BitBlt((0, 0), (self.w, self.h), dcObj, (0, 0), win32con.SRCCOPY)
# convert the raw data into a format opencv can read
signedIntsArray = dataBitMap.GetBitmapBits(True)
img = np.frombuffer(signedIntsArray, dtype='uint8')
img.shape = (self.h, self.w, 4)
# free resources
dcObj.DeleteDC()
cDC.DeleteDC()
win32gui.ReleaseDC(self.hwnd, wDC)
win32gui.DeleteObject(dataBitMap.GetHandle())
img = cv.cvtColor(img, cv.COLOR_BGRA2BGR) # drops alpha + save C_CONTIGUOUS flag
return img |
I think, first source code, only copying from video memory, no compression
You sample capture only inside the window, not desktop? My tests: On: ~ 20 fps Regresion in this function: |
Thanks for the clue @CTPaHHuK-HEbA. I do not close the issue because I hope there is some hidden API, or whatever we could leverage, to improve slightly the situation. I'm open to suggestions too :) |
General information:
Description of the warning/error
if disable windows aero(use classic theme) than performance will increased on x5-x7
Full message
with aero
with classic theme
try tests on win10, win11 and other python versions and type results
Upvote & Fund
The text was updated successfully, but these errors were encountered: