48 lines
919 B
Rust
48 lines
919 B
Rust
use super::{super::Param, Sequence};
|
|
use crate::point::Point;
|
|
use opencv::Result;
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub struct LoadImage {
|
|
finished: bool,
|
|
nb_millis: u64,
|
|
}
|
|
|
|
impl LoadImage {
|
|
pub fn new() -> LoadImage {
|
|
LoadImage {
|
|
finished: false,
|
|
nb_millis: 0,
|
|
}
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
fn sequence_name(&self) -> String {
|
|
"Load_Image".to_owned()
|
|
}
|
|
|
|
fn wait_milis(&self) -> u64 {
|
|
self.nb_millis
|
|
}
|
|
}
|