7 releases

new 0.3.2 Dec 10, 2024
0.3.1 Dec 6, 2024
0.2.0 Jul 25, 2019
0.1.2 Jul 11, 2019
0.1.1 Apr 11, 2019

#53 in Multimedia

Download history 2/week @ 2024-09-19 77/week @ 2024-11-28 252/week @ 2024-12-05

329 downloads per month

MIT license

14KB
205 lines

Highlevel API for Basler Pylon cameras

Crates.io docs Crates.io License

This is a highlevel API on top of the pylon-cxx crate which is a Rust-binding around the official Basler Pylon-SDK.

It provides typestate-pattern based camera objects to avoid common mistakes that lead to runtime errors like opening an already open camera or start grabbing on a already grabbing camera.

It also provides some convenience async stream combinators for linescan cameras.

use std::time::Duration;
use pylon::{ClosedCamera, Pylon, LineCameraExt, GrabStatus, PylonError};

let pylon = Pylon::new();

let cam = ClosedCamera::new(&pylon)?;
let mut cam = cam.open()?;    // this is a OpenCamera struct now.

// we use time futures here but it can ba any kind of future (IO-Cards, network-sockets...)
let start = tokio::time::sleep(Duration::from_secs(1));
let end = tokio::time::sleep(Duration::from_secs(2));

assert!(matches!(
    cam.join_from_until(start, end, Some(1024*1024*100)).await?,
    GrabStatus::Success(_)
));

Copyright 2024, Falco Hirschenberger [email protected]

Dependencies

~6–15MB
~193K SLoC