# flir_rs [![Crates.io](https://img.shields.io/crates/v/flir_rs.svg)](https://crates.io/crates/flir_rs) [![Rust](https://img.shields.io/badge/rust-1.56.1%2B-blue.svg?maxAge=3600)](https://gitlab.com/andrew_ryan/flir_rs) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitlab.com/andrew_ryan/flir_rs/-/raw/master/LICENSE) [![Documentation](https://docs.rs/flir_rs/badge.svg)](https://docs.rs/flir_rs) Library and tools to process thermal images from FLIR cameras. # Overview This crate provides two functionalities: 1. Compute temperature from raw sensor values and ambient parameters (typically stored as metadata in the image). 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`). ```rust 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::>(); 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: 1. stats: Generates temperature stats for a set of images / JSONs 2. transform: Generates temperature valued 16-bit single channel TIFF files for images, with value normalized to encode a given range of temperatures.