From f74c7caf105910d429bf2ab68c349c61e4b34f15 Mon Sep 17 00:00:00 2001 From: Lapin Raving Date: Thu, 14 Sep 2023 21:11:01 +0200 Subject: [PATCH] fix: replace WaitSpace Sequence --- src/main.rs | 4 ++-- src/qualibration.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3305830..5b36f3f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -90,9 +90,9 @@ fn run_all() -> Result<(), Box> { //let _t = framerate_handler.handle_time()?; ///////////////// let key = highgui::wait_key(1)?; - if key != -1 { + //if key != -1 { qualibration.key = key; - } + //} if key == 27 { // esc in my case break; diff --git a/src/qualibration.rs b/src/qualibration.rs index 01e645d..8ccad5c 100644 --- a/src/qualibration.rs +++ b/src/qualibration.rs @@ -45,6 +45,7 @@ const DEBUG: bool = true; pub enum Sequence { //TODO: avoir le meme nombre d'image en mode capture ET en mode replay FirstState, + WaitSpace, BackGround, UpBorder, LeftBorder, @@ -53,7 +54,6 @@ pub enum Sequence { ReadDir, ComputeArea, Finish, - WaitSpace, WaitQ, @@ -324,7 +324,7 @@ impl Qualibration { match self.id.unwrap() { //Sequence::Finish => Some(Sequence::Finish), Sequence::Finish => None, - Sequence::SelectNbAll(mut n) => { + Sequence::SelectNbAll(n) => { if n == 0 { Some(Sequence::SelectNbAll(2 - 1)) } else if (2 * n) > line_max as u16 { @@ -335,7 +335,7 @@ impl Qualibration { } Sequence::WaitSpace => { //println!("key: {}", self.key); - if self.key == 32 { + if self.key == 32 || !self.capture_mode{ next(&Sequence::WaitSpace) } else { Some(Sequence::WaitSpace) @@ -510,6 +510,10 @@ impl Qualibration { let d: Vec<_> = c[c.len()-1].chars().collect(); let e: String = d[4..d.len()-4].iter().collect(); let img_id: i32 = e.parse()?; + //println!("c: {c:?}"); + //let a: Vec<_> = path.to_str().unwrap().to_string().chars().collect(); + //let b: String = a[27..(a.len() - 4)].iter().collect(); + //let img_id: i32 = b.parse()?; let path = format!("{path:?}"); let path = path[1..(path.len() - 1)].to_owned(); let img: Mat = imread(&find_file(&path, false, false)?, IMREAD_COLOR)?;