diff --git a/examples/live.rs b/examples/live.rs index d09a742..afb2ad1 100644 --- a/examples/live.rs +++ b/examples/live.rs @@ -11,6 +11,8 @@ struct Args { temperature: bool, #[arg(short, long, default_value = "/dev/video0")] device: String, + #[arg(short, long)] + red_cutoff: Option, } fn pixel_to_celcius(x: u16) -> u16 { @@ -96,6 +98,13 @@ fn main() -> anyhow::Result<()> { let mut pixel = u16::from_be_bytes([frame[i * 2], frame[i * 2 + 1]]); if args.temperature { pixel = pixel_to_celcius(pixel); + if let Some(cutoff) = args.red_cutoff { + pixel = if pixel > (256.0 * cutoff) as u16 { + 50000 + } else { + 0 + } + } } let pixel_swapped = pixel.to_le_bytes(); swapped[i * 2..i * 2 + 2].copy_from_slice(&pixel_swapped);