Crate flir_rs

Source
Expand description

Library to process flir_rs images from FLIR cameras.

This crate provides two functionalities:

  1. Compute temperature from raw sensor values and ambient parameters (typically stored as metadata in the image). The code is a port of the Thermimage R library and its python port.

  2. Parse parameters and raw sensor values from image metadata. Supports parsing R-JPEGs with FFF encoding of Flir parameters, and parsing ExifTool generated JSON (output from exiftool -b -j).

§Usage

Obtaining pixel-wise temperature values involves (1) extracting the raw sensor values, and the conversion parameters from image metadata; and (2) converting the raw values to temperature values.

§Extracting values and parameters

The crate can directly parse radiometric R-JPEGs from Flir cameras. This is an (incomplete) port of the relevant parts of the excellent ExifTool by Phil Harvey and currently supports R-JPEGs with FFF encoded data. Refer try_from_rjpeg_path for more info.

use flir_rs::ThermalImage;
let image = ThermalImage::try_from_rjpeg_path("image.jpg")?;

The crate can also parse the JSON output from ExifTool via exiftool -b -j via ThermalExiftoolJson and serde_json. This can then be converted to a ThermalImage.

use std::{convert::TryInto, fs::File, io::BufReader};
use flir_rs::{ThermalExiftoolJson, ThermalImage};

let json: ThermalExiftoolJson = serde_json::from_reader(
    BufReader::new(File::open("metadata.json")?)
)?;
let image: ThermalImage = json.try_into()?;

§Converting sensor values to temperatures

The raw sensor values in ThermalImage::image can be converted to temperature in celicius using raw_to_temp method on ThermalImage::settings. This is a port of the Thermimage R library and its python port.

Re-exports§

pub use crate::image::ThermalExiftoolJson;
pub use crate::image::ThermalImage;

Modules§

cli
Helpers to parse CLI arguments in the accompanying binaries.
flir
Parse parameters from FLIR R-JPEGs.
image
Parse and extract raw flir_rs image and temperature params.
parse
Helper macros for parsing packed structs.
stats
Utilities to accumulate first and second moments; min; and max of a f64 statistic incrementally.
temperature
Functions to compute temperature from raw sensor values.

Macros§

arg
args_parser
opt