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.
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.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 694ff252eead35066770f3c2465c7b4d263c359d5ada01233f6accd8b819426d |
|
MD5 | b008f58a54163e874257a5df34f55f13 |
|
BLAKE2b-256 | 6a307a7470ebae7be986c2d32d01ebd655856a458c3bbbed6756fb2f18feaee8 |
Hashes for zbl-0.1.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dff7bf3988e915dd27c1b2f06f15c16312786794d313e64f96a7ad4ed828a5b |
|
MD5 | 61d3b09068c21a0c909651f1c1a25afc |
|
BLAKE2b-256 | f9d35e57f8d6727345a4a52688607568b75e0f3d1902304db44ba75a56974ec1 |
Hashes for zbl-0.1.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 263f7ddf41edc8883916483ef1f425784c9c394767349525642cc199acdc61cb |
|
MD5 | ecca1d6e796c684bd426a512a004c8d9 |
|
BLAKE2b-256 | c36cb14b74c92fe72506c0e82f03b7c5bedbdf7cad981172e93f320484bf73c7 |
Hashes for zbl-0.1.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29781ecd5bb6bec208dcf295fa2f128961720138d2fc6283bba33336e12be06b |
|
MD5 | 25d1c834fa6e76d42cf65c957cd61cea |
|
BLAKE2b-256 | 3da5a5a3270cb243d47d092c5fd6b6a839f9ee3570b247cf2d0e52fbd120feba |
Hashes for zbl-0.1.0-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb806f7e50f6e8624c40d2943123eb454dec50b54ad7def50d90e56c1b1ca5c0 |
|
MD5 | b11b38c5e2d488b869939becef60ae86 |
|
BLAKE2b-256 | 8a0eef96fa663a647aaa0c9b5df9646d8909bc542539256f4545a7356084efbb |