[][src]Trait libblackbody::thermogram_trait::ThermogramTrait

pub trait ThermogramTrait {
    pub fn thermal(&self) -> &Array<f32, Ix2>;
pub fn optical(&self) -> Option<&Array<u8, Ix3>>;
pub fn identifier(&self) -> &str;
pub fn path(&self) -> Option<&str>; pub fn render(
        &self,
        min_temp: f32,
        max_temp: f32,
        palette: [[f32; 3]; 256]
    ) -> Array<u8, Ix3> { ... }
pub fn render_defaults(&self) -> Array<u8, Ix3> { ... }
pub fn export_thermal(&self, path: &PathBuf) -> Option<()> { ... }
pub fn save_render(
        &self,
        path: PathBuf,
        min_temp: f32,
        max_temp: f32,
        palette: [[f32; 3]; 256]
    ) -> Option<()> { ... }
pub fn thermal_shape(&self) -> [usize; 2] { ... }
pub fn has_optical(&self) -> bool { ... }
pub fn min_temp(&self) -> f32 { ... }
pub fn max_temp(&self) -> f32 { ... }
pub fn normalized_minmax(&self) -> Array<f32, Ix2> { ... } }

All supported thermogram formats implement this trait.

pub trait ThermogramTrait {
    fn thermal(&self) -> &Array<f32, Ix2>;  // Extract the thermal data
    fn optical(&self) -> &Array<u8, Ix3>>;  // Extract embedded photos, if present
    fn identifier(&self) -> &str;  // A uniquely identifying string for this thermogram
    fn render(&self min_temp: f32, max_temp: f32, palette: [[f32; 3]; 256]) -> Array<u8, Ix3>;  // Thermal data render using the given palette
    fn render_defaults(&self) -> Array<u8, Ix3>;  // Thermal data rendered using the minimum and maximum thermal value and the `palette::TURBO` palette.
    fn thermal_shape(&self) -> [usize; 2];  // The [height, width] of the thermal data
    fn normalized_minmax(&self) -> Array<f32, Ix2>;  // Thermal data normalized to lie in the range 0.0..=1.0
}

Required methods

pub fn thermal(&self) -> &Array<f32, Ix2>[src]

Returns a reference to the 2D array of thermal data in celsius.

pub fn optical(&self) -> Option<&Array<u8, Ix3>>[src]

Returns reference to the raw RGB values of the thermogram's corresponding optical photo, if present. Otherwise None.

pub fn identifier(&self) -> &str[src]

Provide the identifier for this thermogram, which is typically the file path. It can also be a randomly generated uuid or similar, however, if there is no path associated with the data.

pub fn path(&self) -> Option<&str>[src]

Loading content...

Provided methods

pub fn render(
    &self,
    min_temp: f32,
    max_temp: f32,
    palette: [[f32; 3]; 256]
) -> Array<u8, Ix3>
[src]

Render the thermogram with the given color palette and using the given minimum and maximum temperature bounds.

All values are clipped to be between the minimum and maximum value, then put in one of 256 bins. Each bin is mapped to one of the colors in the palette to render an RGB color value.

Arguments

  • min_temp - The temperature value, and all values below it, that needs to be mapped to the first color in the palette.
  • max_temp - The temperature value, and all values above it, that needs to be mapped to the last color in the palette.
  • palette - A collection of 256 colors to which the 256 bins will be mapped.

Returns

A three-dimensional RGB array of u8 values between 0 and 255.

pub fn render_defaults(&self) -> Array<u8, Ix3>[src]

Render the thermogram using the minimum and maximum thermal value and the

pub fn export_thermal(&self, path: &PathBuf) -> Option<()>[src]

Export thermal data to a tiff file.

Arguments

path - Where to save the thermogram export to. Regardless of the file extension, a tiff file is created.

Returns

Some<()> in case of success, otherwise None.

pub fn save_render(
    &self,
    path: PathBuf,
    min_temp: f32,
    max_temp: f32,
    palette: [[f32; 3]; 256]
) -> Option<()>
[src]

Save render to file.

Arguments

path - Where to save the render to. The image type is extrapolated from the extension. min_temp - The minimum temperature for the render, see render(..). max_temp - The maximum temperature for the render, see render(..). palette - The color palette to render the thermogram with, see render(..).

Returns

Some<()> in case of success, otherwise None.

pub fn thermal_shape(&self) -> [usize; 2][src]

Gives the shape of the thermal data, in the order of [height, width].

pub fn has_optical(&self) -> bool[src]

pub fn min_temp(&self) -> f32[src]

Returns the lowest temperature in the thermogram, or f32::MAX if there is no such value.

pub fn max_temp(&self) -> f32[src]

Returns the highest temperature in the thermogram, or f32::MIN if there is no such value.

pub fn normalized_minmax(&self) -> Array<f32, Ix2>[src]

Normalized the thermal array to lie in the 0.0..=1.0 in such a way to prevent division by 0 errors.

Loading content...

Implementors

impl ThermogramTrait for Thermogram[src]

The ThermogramTrait implemented for the Thermogram enum. Method calls are forwarded to the specific format wrapped by the enum. Consult the trait for documentation on the supported methods.

impl ThermogramTrait for FlirThermogram[src]

impl ThermogramTrait for TiffThermogram[src]

Loading content...