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.1.2-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a4ba7ebc61329b8933d64c1c6d7cdf691b1701d6f5a354cfbae1e23441fb43d |
|
MD5 | 47463ab9813b2fa247c781ae0c40ed73 |
|
BLAKE2b-256 | 0ded9aafdfa9ea531db21f28629dc1f327183471dc60ed27e8c1edcdaea2da0c |
Hashes for zbl-0.1.2-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be1693a44e8db9c116ae1b56144f4973c44d227c11deea3f9b9ff76f903fb7c6 |
|
MD5 | eec33378de93e45ff2c8c67efac82566 |
|
BLAKE2b-256 | cb2a0d327f7d1f2d3326fa4d2dbc4af093aab8f52f7f538f360b43a166b2845b |
Hashes for zbl-0.1.2-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4403569985461292dc81b3a2952eddd04bacf8736d6131ac1b9b9017d89841dc |
|
MD5 | 31c678a6ef739916bc7bcc30afa45219 |
|
BLAKE2b-256 | b269555a5f09b9a10bbdf149e9eebe3158b4acb5bdc1c8d3c9a251fd53a44f15 |
Hashes for zbl-0.1.2-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80b90db44c4588213802a18a3d4b80acbe054a3dd8211e81b3df208847d1ff36 |
|
MD5 | 313112035efeb6988491c95840c2102a |
|
BLAKE2b-256 | 4a07f8ff595d410936c2c7dd77464949d167b78460ae0c26e55c16782ed2cb63 |
Hashes for zbl-0.1.2-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28a598620ab676b8aff19142bd3dd6da341c8b2174580f39cb5379ef5c674f25 |
|
MD5 | e7a8d7036b72b7d923b8be04067fa86e |
|
BLAKE2b-256 | 636d50c34fb59be2b62dc193b56c89762d52cb5a54ec6a608a5c46391d3e4c9a |
Hashes for zbl-0.1.2-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebcd7d8a845dedfd9fe1af17759627b5319401f26375f1057d0bb63de736e210 |
|
MD5 | 9a942c994a0fcd6be050cf91bbe7795b |
|
BLAKE2b-256 | e08a2ce2dcc7b773ed9db1dec65f871b27a16746368977f7e04c0421b4a1364a |