real-time window capture library based on D3D11 and Windows.Graphics.Capture
Project description
zbl
zbl
is a Rust and Python library for screen/window capturing. It provides an interface
to Windows.Graphics.Capture
API with a focus on simplifying integrating computer vision applications for Windows Desktop apps.
This library is in early development stage. This means that it's only verified to work for a 'happy path' scenarios - beware of bugs!
Python
Installation
pip install zbl
Alternatively, you can install suitable wheel from releases page.
Usage
from zbl import Capture
with Capture(window_name='visual studio code') as cap:
frame = next(cap.frames())
print(frame.shape)
The snippet above will capture a window which title contains the string visual studio code
, take one frame (which is represented as a numpy
array) and print its shape.
See Capture
constructor for more options. It is possible to capture the entire screen using display_id
argument,
for example.
To run an example using OpenCV's highgui
:
- Install
opencv-python
- Run
python -m zbl --display-id 0
Rust
See examples. Note: if you are getting OpenCV build errors when building the example, check out how to build OpenCV rust bindings.
Comparison to mss
/ pyautogui
Both are very slow at the time of writing. mss
tops at 30-50 fps in a tight loop, pyautogui
is
even slower than that. zbl
is able to capture an order of magnitude faster (at 500-700 fps). This allows a lot more time for the actual processing.
Plans
- (in progress) Integration with
GpuMat
s & full on-GPU processing
Credits
zbl
is heavily inspired by screenshot-rs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for zbl-0.6.0-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5727be8dccfb52bcf71ade3e7913d9d09ca107138e1dbfd6f09494056e057bb3 |
|
MD5 | 9154f60a3d8e3ff0566534a5e504703f |
|
BLAKE2b-256 | 4627ea31826771cf7ab053c5e89fdf459e1455a171b9759e5bd781fe4f5f6ee4 |
Hashes for zbl-0.6.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e36354ad7b98a93c3b5b51dca9c0c114d17d70bb2f6594e22c7f9aa49159dcaf |
|
MD5 | 5e536783005a657efe5eed0ecaf71562 |
|
BLAKE2b-256 | 8b6b51e23f49468416eab81cb24300ca2928627f189d0f66f4c1574949355caf |
Hashes for zbl-0.6.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63d1410f308e7c710df9e252f9c1a6460d486587ffa0d368f365f7a58bb7df46 |
|
MD5 | 33754b455dc6f0c588a6c544e8b54913 |
|
BLAKE2b-256 | fc1810df47d0e995c19a43acaec66af0a44add8e846941c6bf3381e531d38725 |
Hashes for zbl-0.6.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd812b60f1f8a125864a424eb7adb133bcb9b899ad325a5a46cc7d41838a843d |
|
MD5 | 35e645a0c935ba25e6d264af5ddec524 |
|
BLAKE2b-256 | c9d84877a62fa0f72ccc4a8f9c665f492de18db447e90a0626bd87e23fb57468 |
Hashes for zbl-0.6.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2be509d857e4d42dcce49e9bf986304c4968be1cf42dc9ce69bde0bf145d9305 |
|
MD5 | e0a9fd83a06aa75aeb672b33be62b576 |
|
BLAKE2b-256 | 3b8819d172ec7997bb34e06fa06bd51778bc3c05c4af8e3cb3d64f82b992c690 |