fix: remove read cam when PlayLineDotted

This commit is contained in:
Lapin Raving 2023-09-14 22:41:43 +02:00
parent dee7199b09
commit 550021a014
3 changed files with 10 additions and 10 deletions

View File

@ -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<dyn std::error::Error>> {
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);
}
}

View File

@ -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<dyn std::error::Error>> {
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});
}
}

View File

@ -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<f64, 4> = 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)?;