eye-hal
eye-hal
strives to provide a hardware abstraction layer (HAL) for camera-like devices in Rust.
This includes common consumer grade RGB/YUV webcams as well as more sophisticated (infrared, mono)
hardware. All output buffer types should be supported, even multi-planar buffers.
Apart from buffer capturing, eye-hal
also provides an abstraction for hardware control. An
example use-case would be white-balance or focus control.
Design
All platform (aka backend) specific code goes into src/platform. The rest should be platform agnostic code. Traits shared between platform implementations go into src/traits.rs.
There are three main entities when it comes to a HAL implementation:
Context
A platform specific context used to query devices and general system information. It is also used to actually open a device by acquiring a handle.Device
This represents the sensor hardware itself. It can be used to manipulate hardware controls such as focus, white balance or gain levels. The main functionality however is in thestart_stream()
function, where you can create an input stream for capturing buffers.Stream
A stream is an entitiy which provides access to the buffers captured by the camera sensor. Only one buffer is available at any time - this is a design decision made in the current code. Whenever possible, we try to implement the stream as a zero-copy mechanism (only a view of the buffer data is returned to the caller).
Usage
Below you can find a quick example usage of this crate. It introduces the basics necessary for frame capturing.
use PlatformContext;
use ;
Have a look at the provided examples
for more sample applications.