Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lightsing/windows-cap
https://github.com/lightsing/windows-cap
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/lightsing/windows-cap
- Owner: lightsing
- License: mit
- Created: 2024-02-08T11:47:59.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-02-11T08:13:05.000Z (11 months ago)
- Last Synced: 2024-02-11T09:22:30.472Z (11 months ago)
- Language: Rust
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Windows Capture
Utilize the Windows Graphics Capture API to capture the client area of a window.
Requires Windows 10 and Python 3.8 or later.
## Usage
```python
import cv2
import numpy as np
from windows_cap import WindowCapture# Create a WindowCapture object with the window title and class name (optional)
wincap = WindowCapture("Untitled - Notepad", "CLASSNAME")while True:
data = wincap.next()
w, h = wincap.client_size
img = np.frombuffer(data, dtype=np.uint8)
img = np.reshape(img, (h, w, 4))
img = cv2.resize(img, (w // 4, h // 4))
cv2.imshow("WGC", img)
if cv2.waitKey(1) == ord('q'):
cv2.destroyAllWindows()
break
```