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
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.1-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e9a3007e52477a6c77ff3b1cdc4908b6e076bbdd13620d8ba4777fa19e10d74 |
|
MD5 | 2e410680ea9c4972fa42f3fa72d74a4a |
|
BLAKE2b-256 | c48748a5b07562389ff0c410338dd8af868ce82769cc6c203bded4dbe535778f |
Hashes for zbl-0.1.1-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b785768be3a361af48ddc79fd4961dfe1b44856927d61c97b5c3e5d2b3f4b4cf |
|
MD5 | 0d0820ee552e06e63c0566645aa96455 |
|
BLAKE2b-256 | 4c9cfff3d3a1f1540de3a5e2ff4a5eda27e4b50ffdd4ae8ee80be97501633355 |
Hashes for zbl-0.1.1-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b21592585e6e48f2fffb80b5c897541b4cd0c3e67c1c185229a503289030ff2 |
|
MD5 | 0f2c0c1802cabe77b82a5e80b6759889 |
|
BLAKE2b-256 | 03f4f4e36f1e3823c9c4116188abb7b7825f717df7b7a43e906cf6fba8a8c8be |
Hashes for zbl-0.1.1-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa3eb5b19d6c7eee8a37fef04d75e74e2fe4a01b1fd9493a081e59d7aec6e345 |
|
MD5 | 7867ef8d6e3efb4bd00fe720a1c9e5fa |
|
BLAKE2b-256 | a2d3eb7f315b2d45ffa0c9e77196b97636fcfea0959b062da5b9fb8bd7c94117 |
Hashes for zbl-0.1.1-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e697bf8394c74e7661e068e59c9224f784187f9c902111174618c6db8fa316e7 |
|
MD5 | a9b80ba3438ef7d7487b522ad13469b0 |
|
BLAKE2b-256 | 5bde1f078e6dbd049acd5380ea3e137c2c92228f77261d7ca98475b41b94552d |