lj_qualibration/src/qualib_refacto/load_image.rs

34 lines
712 B
Rust

use super::{Param, Sequence};
use crate::point::Point;
use opencv::{core::Mat, Result};
#[derive(Debug, Clone, Copy)]
pub struct LoadImage {
finished: bool,
}
impl LoadImage {
pub fn new() -> LoadImage {
LoadImage { finished: true }
}
}
impl Sequence for LoadImage {
fn draw(&self, _mem: &Param) -> Option<Vec<Point>> {
if self.finished {
return None;
}
Some(vec![])
}
fn compute_sequence(&mut self, mem: &mut Param) -> Result<(), Box<dyn std::error::Error>> {
if !mem.capture_mode {
mem.load_image()?;
}
self.finished = true;
Ok(())
}
fn is_capture(&self) -> bool {
false
}
}