From 550021a01415dc9bbe7383070fd1f6534501c27a Mon Sep 17 00:00:00 2001 From: Lapin Raving Date: Thu, 14 Sep 2023 22:41:43 +0200 Subject: [PATCH] fix: remove read cam when PlayLineDotted --- src/main.rs | 6 +++--- src/qualibration.rs | 12 ++++++------ src/qualibration/annalyse.rs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index 675016c..cc39b18 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ mod point; mod qualibration; mod utils; -use qualibration::{annalyse::adding_trackbar, Qualibration}; +use qualibration::{annalyse::adding_trackbar, Qualibration, Sequence}; use conf::Conf; use log::{/*debug, warn, */ error, info}; @@ -112,8 +112,8 @@ fn run_all() -> Result<(), Box> { qualibration.run_step()?; - if qualibration.capture_mode { - let millis = std::time::Duration::from_millis(300); // TODO: find solution to know when change has been done + if qualibration.capture_mode && (qualibration.id != Some(Sequence::WaitSpace) || qualibration.id != Some(Sequence::PlayLineDotted)) { + let millis = std::time::Duration::from_millis(400); // TODO: find solution to know when change has been done std::thread::sleep(millis); } } diff --git a/src/qualibration.rs b/src/qualibration.rs index 8c48de7..d68358f 100644 --- a/src/qualibration.rs +++ b/src/qualibration.rs @@ -146,12 +146,12 @@ impl Qualibration { border_pt: vec![], homography: Mat::default(), h_size: Size::default(), - line_pos: vec![4095; 100], + line_pos: vec![4095; 34], }) } pub fn run_step(&mut self) -> Result<(), Box> { - if self.capture_mode { + if self.capture_mode && self.id != Some(Sequence::PlayLineDotted) { //println!("capture"); self.cam.read(&mut self.frame)?; highgui::imshow("camera", &self.frame)?; @@ -258,15 +258,15 @@ impl Qualibration { for _ in 0..nb_all { pl.push(Point{x: 0., y: 0., color: black}); } - let len = (self.line_pos.len() + nb_wait) as f32; + let len = (2*self.line_pos.len() + nb_wait) as f32; for i in 0..nb_wait { let y = i as f32 * 4095. / len; pl.push(Point{x: 0., y, color: black}); } - for i in 0..(self.line_pos.len()) { + for i in 0..(self.line_pos.len() * 2) { let y = (i + nb_wait) as f32 * 4095. / len; - let c = if (i + nb_wait) % 2 == 0 {color} else {black}; - pl.push(Point{x: self.line_pos[i] as f32, y, color: c}); + let c = if (i + nb_wait) % 2 == 0 && i < nb_visible {color} else {black}; + pl.push(Point{x: self.line_pos[i/2] as f32, y, color: c}); } } diff --git a/src/qualibration/annalyse.rs b/src/qualibration/annalyse.rs index 9336bf0..090d04f 100644 --- a/src/qualibration/annalyse.rs +++ b/src/qualibration/annalyse.rs @@ -340,7 +340,7 @@ pub fn trackbar_init_param(mem: &mut Qualibration, winname: &str) -> Result<()> named_window(winname, WINDOW_AUTOSIZE)?; highgui::move_window(winname, 20, 20)?; let v: VecN = VecN::new(0., 0., 0., 255.); - let m = Mat::new_rows_cols_with_default(1, 512, CV_8UC3, v)?; + let m = Mat::new_rows_cols_with_default(1, 1024, CV_8UC3, v)?; highgui::imshow(winname, &m)?; create_trackbar("nb_all", winname, Some(&mut mem.nb_all), 400, None)?;