No project description provided
Project description
zbl
zbl
is a Rust and Python library aiming to make it easier to integrate OpenCV (and possibly other CV libraries) with
Windows Desktop apps for real-time processing. It does so by providing a simplified interface to
Windows.Graphics.Capture
.
This library is not well-tested against corner cases, and was only verified to work for a 'happy path' scenarios, so 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 --window-name '<full or partial window name, case insensitive>'
Rust
See examples. Note: if you are getting OpenCV build errors when building the example, check out how to build OpenCV rust bindings.
Why not mss
/ pyautogui
?
Those are the definition of "slow" at the time of writing. mss
tops at 30-50 fps in a tight loop, pyautogui
is
even slower than that. Due to GPU accel which comes with D3D11, zbl
captures at 500-700 fps - an order of magnitude faster, which allows a lot more time for the actual processing.
Why Rust for the native code part and not C++ / C#?
I need it for the Rust project, hence it is in Rust.
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.2.0-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b46fa5fbdb8c4973eec9aae217be21354d794353160ae80821a2603c1da2e76c |
|
MD5 | bd6f78cca2438bb38171e074c237650f |
|
BLAKE2b-256 | 98be3e508845d60ebfb3ce334d0766569f8afba566ce0d059665e0c725fe6a52 |
Hashes for zbl-0.2.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a23e94c85741a1b1df5cb51cb8abc72249c8c2f95f0062fd2b5b35692a96028 |
|
MD5 | 2e80ad4975c8c817bdd041d6e0c3d8fe |
|
BLAKE2b-256 | d0ed0bfc834ff14db306d6251696e2ed7ef28247eaab2ea53de706c1676b63c7 |
Hashes for zbl-0.2.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab08b25b6aeb87b3deeffe6a65b5d298fac38e77885ccd2323380fb6c3d9e404 |
|
MD5 | e215d215fe4a29d7c0794a9343935528 |
|
BLAKE2b-256 | 8681d94b8498a2f089e12e79c670001bab4f5437f900800839d17de08f4e333a |
Hashes for zbl-0.2.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af5c4352b6ce4b5438d108f474d992fe48bb2c5313765e8cf1f0daca871a7453 |
|
MD5 | d531f2ad6f88bbefecc337407b7ddb61 |
|
BLAKE2b-256 | 926b3776174da36022b9bc00a64d425e8546b3d275e3de929193f5f4954b018f |
Hashes for zbl-0.2.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31ebb39ad9133ba9362e49cd4e90896b88531160f684400d862889ed20bd66de |
|
MD5 | 290bda4a756617439c28b369eee4bd41 |
|
BLAKE2b-256 | 306e9fe717c6c7c23281aaecea6163d4c06099aad43b06c640e0b2a1c54f2420 |
Hashes for zbl-0.2.0-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85e7e4084b04321b305aade3b93c379624304c497f2c4137246eaa10a747f9e7 |
|
MD5 | f78f14844e2949ee2f4d2e49e0d008c9 |
|
BLAKE2b-256 | b683aa2beef33727518392e427280ae04bbc09460cd9bc90ae2badb6d88344d9 |