Crate cameraunit
source ·Expand description
§cameraunit
cameraunit
provides a well-defined and ergonomic API to write interfaces to capture frames from CCD/CMOS based
detectors through Rust traits cameraunit::CameraUnit
and cameraunit::CameraInfo
. The library additionally
provides the cameraunit::ImageData
struct to obtain images with extensive metadata.
You can use cameraunit
to:
- Write user-friendly interfaces to C APIs to access different kinds of cameras in a uniform fashion,
- Acquire images from these cameras in different pixel formats (using the
image
crate as a backend), - Save these images to
FITS
files (requires thecfitsio
C library, and uses thefitsio
crate) with extensive metadata, - Alternatively, use the internal
serialimage::DynamicSerialImage
object to obtainJPEG
,PNG
,BMP
etc.
§Usage
Add this to your Cargo.toml
:
[dependencies]
cameraunit = "5.1"
and this to your source code:
use cameraunit::{CameraUnit, CameraInfo, DynamicSerialImage, OptimumExposureBuilder, SerialImageBuffer};
§Example
Since this library is mostly trait-only, refer to projects (such as cameraunit_asi
) to see it in action.
§Notes
The interface provides two traits:
CameraUnit
: This trait supports extensive access to the camera, and provides the API for mutating the camera state, such as changing the exposure, region of interest on the detector, etc. The object implementing this trait should not derive from theClone
trait, since ideally image capture should happen in a single thread.CameraInfo
: This trait supports limited access to the camera, and provides the API for obtaining housekeeping data such as temperatures, gain etc., while allowing limited mutation of the camera state, such as changing the detector temperature set point, turning cooler on and off, etc.
Ideally, the crate implementing the camera interface should
- Implement the
CameraUnit
andCameraInfo
for astruct
that does not allow cloning, and implement a second, smaller structure that allows clone and implement onlyCameraInfo
for that struct. - Provide functions to get the number of available cameras, a form of unique identification for the cameras, and to open a camera using the unique identification. Additionally, a function to open the first available camera may be provided.
- Upon opening a camera successfully, a tuple of two objects - one implementing the
CameraUnit
trait and another implementing theCameraInfo
trait, should be returned. The second object should be clonable to be handed off to some threads if required to handle housekeeping functions.
Structs§
- Image metadata structure. This structure implements the
std::fmt::Display
andstd::clone::Clone
traits. - Configuration used to find the optimum exposure.
- Builder for the [
serialimage::OptimumExposure
] calculator. - This structure defines a region of interest. The region of interest is defined in the un-binned pixel space.
Enums§
- Dynamic serial image enumeration. This data type encapsulates the specific serial image data types.
- Errors returned by camera operations.
Traits§
- Trait for obtaining camera information and cancelling any ongoing image capture. This trait is intended to be exclusively applied to a clonable object that can be passed to other threads for housekeeping purposes.
- Trait for controlling the camera. This trait is intended to be applied to a non-clonable object that is used to capture images and can not be shared across threads.
- The type of each channel in a pixel. For example, this can be
u8
,u16
,f32
.
Type Aliases§
- Result of an image decoding/encoding process