Expand description
§spectro-rs
A high-performance Rust driver for X-Rite ColorMunki spectrometers.
This crate provides a safe, ergonomic interface for interacting with ColorMunki (Original and Design) devices, supporting reflective, emissive, and ambient measurement modes.
§Quick Start
ⓘ
use spectro_rs::{discover, MeasurementMode};
fn main() -> spectro_rs::Result<()> {
// Find and connect to a device
let mut device = discover()?;
println!("Found: {:?}", device.info()?);
// Calibrate for reflective measurements
device.calibrate()?;
// Measure and get spectral data
let spectrum = device.measure(MeasurementMode::Reflective)?;
let xyz = spectrum.to_xyz();
println!("CIE XYZ: X={:.2}, Y={:.2}, Z={:.2}", xyz.x, xyz.y, xyz.z);
Ok(())
}§Architecture
The crate is organized into several layers:
-
Transport Layer (
transport): Abstracts low-level communication (USB, Bluetooth, etc.). Seetransport::Transporttrait. -
Device Layer (
device): Defines the unifieddevice::Spectrometertrait that all device implementations must follow. -
Device Implementations: Concrete drivers like
munki::Munkithat implement thedevice::Spectrometertrait. -
Colorimetry (
colorimetry,spectrum): Color science utilities for converting spectral data to various color spaces.
Re-exports§
pub use device::BoxedSpectrometer;pub use device::DeviceInfo;pub use device::DevicePosition;pub use device::DeviceStatus;pub use device::Spectrometer;pub use spectrum::MeasurementMode as SpectrumMeasurementMode;pub use spectrum::SpectralData;pub use transport::Transport;pub use transport::UsbTransport;
Modules§
- cam02
- CIECAM02 Color Appearance Model and CAM02-UCS Uniform Color Space.
- colorimetry
- device
- High-level spectrometer device abstraction.
- i18n
- icc
- munki
- ColorMunki spectrometer driver.
- persistence
- Persistence layer for spectrometer calibration data.
- spectrum
- sprague
- tm30
- TM-30-18 Color Quality Evaluation Metrics
- tm30_
data - tm30_
data_ cmf - transport
- Hardware abstraction layer for spectrometer communication.
Macros§
Enums§
- Illuminant
- Standard CIE Illuminants.
- Measurement
Mode - Specifies the type of measurement to perform.
- Observer
- Standard CIE Observers.
- Spectro
Error - The error type for spectrometer operations.
Constants§
- WAVELENGTHS
- Standard wavelength bands (380nm - 780nm in 10nm steps).
Functions§
- discover
- Discovers and connects to the first available spectrometer.
- discover_
with_ context - Discovers a spectrometer using a provided USB context.
- list_
devices - Lists all detected spectrometer devices without connecting.