Skip to main content

Crate libblackbody

Crate libblackbody 

Source
Expand description

This the library libblackbody which intends to be a general purpose thermogram file reading library. Currently it supports FLIR jpegs, Fluke .is2 files, TIFF files and 16-bit grayscale PNGs. It is used by Blackbody, a thermogram viewer.

flyr and serendip allow decoding FLIR and Fluke files, respectively. TIFF and PNG files are decoded by the image project.

§Installation

This library is available on crates.io. Install by adding it to your Cargo.toml.

§Usage

Call Thermogram::from_file on your file to get a Thermogram object. It can be used according to the specification of ThermogramTrait. For data already in memory — from a network stream, archive, or similar — use Thermogram::from_bytes instead.

use libblackbody::Thermogram;
use std::path::Path;

let file_path = Path::new("/home/user/FLIR0123.jpg");
match Thermogram::from_file(file_path) {
    Err(e) => println!("Failed opening thermogram {:?}: {}", file_path, e),
    Ok(thermogram) => {
        println!("Successfully opened thermogram {:?}", file_path);
        // Do something with `thermogram`
        // ...
    },
}

The file is allowed to be a FLIR jpeg, a Fluke .is2, a TIFF or a 16-bit grayscale PNG.

§Interface of a thermogram

See ThermogramTrait for the methods available on a thermogram: extracting thermal data, the embedded visual photo, camera info, capture parameters, measurements and their statistics, rendering with a palette, and exporting. A number of color palettes to render with are provided in the palettes module. Optionally, enable the (default-off) ndarray feature for ndarray conversions via the ThermogramNdarrayExt extension trait.

§Units and conventions

Temperatures are typed uom ThermodynamicTemperature values rather than bare floats, so they can be read in any unit without ambiguity. Integer TIFF and 16-bit grayscale PNG values are interpreted as centikelvin, float TIFF values as kelvin. export_thermal writes a 32-bit float TIFF in kelvin; export_thermal_png writes a 16-bit grayscale PNG in centikelvin.

§Issue tracking

Issue tracking happens in the Blackbody repository.

Re-exports§

pub use crate::camera::CameraMetadata;
pub use crate::capture::CaptureParameters;
pub use crate::codecs::flir::FlirThermogram;
pub use crate::codecs::fluke::FlukeThermogram;
pub use crate::codecs::hti::decode::HtiThermogram;
pub use crate::codecs::irg::format::IrgThermogram;
pub use crate::codecs::png::PngThermogram;
pub use crate::codecs::tiff::TiffThermogram;
pub use crate::error::Error;
pub use crate::measurements::Measurement;
pub use crate::pip::PipGeometry;
pub use crate::pip::PipRect;
pub use crate::thermal::ThermVec;
pub use crate::thermogram::Thermogram;
pub use crate::thermogram_trait::ThermogramTrait;

Modules§

camera
Identification of the camera that captured a thermogram.
capture
The object and environment settings a camera measured temperatures with.
codecs
error
measurements
palettes
pip
The shared picture-in-picture compositor: formats translate their stored geometry into a PipGeometry, which composite crops, resizes and overlays.
thermal
The ThermVec thermal-data type and helpers to build it from raw f32 values.
thermogram
thermogram_trait
visual