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 key = highgui::wait_key(1)?;
if key != -1 {
//if key != -1 {
qualibration.key = key;
}
//}
if key == 27 {
// esc in my case
break;

View File

@ -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)?;