fix: replace WaitSpace Sequence

This commit is contained in:
Lapin Raving 2023-09-14 21:11:01 +02:00
parent e991fffdb1
commit f74c7caf10
2 changed files with 9 additions and 5 deletions

View File

@ -90,9 +90,9 @@ fn run_all() -> Result<(), Box<dyn std::error::Error>> {
//let _t = framerate_handler.handle_time()?; //let _t = framerate_handler.handle_time()?;
///////////////// /////////////////
let key = highgui::wait_key(1)?; let key = highgui::wait_key(1)?;
if key != -1 { //if key != -1 {
qualibration.key = key; qualibration.key = key;
} //}
if key == 27 { if key == 27 {
// esc in my case // esc in my case
break; break;

View File

@ -45,6 +45,7 @@ const DEBUG: bool = true;
pub enum Sequence { pub enum Sequence {
//TODO: avoir le meme nombre d'image en mode capture ET en mode replay //TODO: avoir le meme nombre d'image en mode capture ET en mode replay
FirstState, FirstState,
WaitSpace,
BackGround, BackGround,
UpBorder, UpBorder,
LeftBorder, LeftBorder,
@ -53,7 +54,6 @@ pub enum Sequence {
ReadDir, ReadDir,
ComputeArea, ComputeArea,
Finish, Finish,
WaitSpace,
WaitQ, WaitQ,
@ -324,7 +324,7 @@ impl Qualibration {
match self.id.unwrap() { match self.id.unwrap() {
//Sequence::Finish => Some(Sequence::Finish), //Sequence::Finish => Some(Sequence::Finish),
Sequence::Finish => None, Sequence::Finish => None,
Sequence::SelectNbAll(mut n) => { Sequence::SelectNbAll(n) => {
if n == 0 { if n == 0 {
Some(Sequence::SelectNbAll(2 - 1)) Some(Sequence::SelectNbAll(2 - 1))
} else if (2 * n) > line_max as u16 { } else if (2 * n) > line_max as u16 {
@ -335,7 +335,7 @@ impl Qualibration {
} }
Sequence::WaitSpace => { Sequence::WaitSpace => {
//println!("key: {}", self.key); //println!("key: {}", self.key);
if self.key == 32 { if self.key == 32 || !self.capture_mode{
next(&Sequence::WaitSpace) next(&Sequence::WaitSpace)
} else { } else {
Some(Sequence::WaitSpace) Some(Sequence::WaitSpace)
@ -510,6 +510,10 @@ impl Qualibration {
let d: Vec<_> = c[c.len()-1].chars().collect(); let d: Vec<_> = c[c.len()-1].chars().collect();
let e: String = d[4..d.len()-4].iter().collect(); let e: String = d[4..d.len()-4].iter().collect();
let img_id: i32 = e.parse()?; 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 = format!("{path:?}");
let path = path[1..(path.len() - 1)].to_owned(); let path = path[1..(path.len() - 1)].to_owned();
let img: Mat = imread(&find_file(&path, false, false)?, IMREAD_COLOR)?; let img: Mat = imread(&find_file(&path, false, false)?, IMREAD_COLOR)?;