2 releases
0.1.2 | Jan 11, 2024 |
---|---|
0.1.1 | Jan 10, 2024 |
#1923 in Development tools
64KB
1.5K
SLoC
flir_rs
Library and tools to process thermal images from FLIR cameras.
Overview
This crate provides two functionalities:
-
Compute temperature from raw sensor values and ambient parameters (typically stored as metadata in the image).
-
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
).
let path = "demo.jpg";
let path = Path::new(path);
let img = image::open(path).unwrap();
let (width, height) = img.dimensions();
let img = ThermalImage::try_from_rjpeg_path(path).unwrap();
let settings = img.settings;
let sensor_values = img.image.iter().map(|s| *s).collect::<Vec<_>>();
let mut temp_vec = vec![vec![0.0; img_width]; img_height];
for (i, val) in sensor_values.chunks(img_width).enumerate() {
for (j, temp) in val.iter().enumerate() {
// temp is sensor_value
temp_vec[i][j] = *temp;
}
}
for pos in &box_1_vec {
let val = temp_vec[pos.1][pos.0];
// 4.0 is object distance
// new_temp is sensor_value to celcius
let new_temp = settings.raw_to_temp(4.0, val);
box_1_temp_vec.push(new_temp);
}
Please see [crate documentation][docs] for more information
Tools
The crate also provides two handy binaries:
- stats: Generates temperature stats for a set of images / JSONs
- transform: Generates temperature valued 16-bit single channel TIFF files for images, with value normalized to encode a given range of temperatures.
Dependencies
~14–23MB
~298K SLoC