debugging - runs but no output

This commit is contained in:
Jules Youngberg 2022-06-06 23:00:07 -07:00
parent 6e26787c8a
commit 87bc848557
2 changed files with 20 additions and 6 deletions

View File

@ -62,11 +62,14 @@ mod examples {
imgproc::cvt_color(&raw_frame, &mut rgb_frame, imgproc::COLOR_BGR2RGB, 0)?; imgproc::cvt_color(&raw_frame, &mut rgb_frame, imgproc::COLOR_BGR2RGB, 0)?;
opencv::core::flip(&rgb_frame, &mut flip_frame, 1)?; // horizontal opencv::core::flip(&rgb_frame, &mut flip_frame, 1)?; // horizontal
println!("processing");
let data = detector.process(&flip_frame); let data = detector.process(&flip_frame);
println!("received {} landmarks", data.len());
highgui::imshow(window, &mut flip_frame)?; highgui::imshow(window, &mut flip_frame)?;
println!("LANDMARK: {} {} {}", data[0].x, data[0].y, data[0].z);
if data.len() > 0 {
println!("LANDMARK: {} {} {}", data[0].x, data[0].y, data[0].z);
}
} else { } else {
println!("WARN: Skip empty frame"); println!("WARN: Skip empty frame");
} }
@ -107,9 +110,13 @@ mod examples {
opencv::core::flip(&rgb_frame, &mut flip_frame, 1)?; // horizontal opencv::core::flip(&rgb_frame, &mut flip_frame, 1)?; // horizontal
let data = detector.process(&flip_frame); let data = detector.process(&flip_frame);
println!("received {} landmarks", data.len());
highgui::imshow(window, &mut flip_frame)?; highgui::imshow(window, &mut flip_frame)?;
println!("LANDMARK: {} {} {}", data[0].x, data[0].y, data[0].z);
if data.len() > 0 {
println!("LANDMARK: {} {} {}", data[0].x, data[0].y, data[0].z);
}
} else { } else {
println!("WARN: Skip empty frame"); println!("WARN: Skip empty frame");
} }
@ -150,9 +157,13 @@ mod examples {
opencv::core::flip(&rgb_frame, &mut flip_frame, 1)?; // horizontal opencv::core::flip(&rgb_frame, &mut flip_frame, 1)?; // horizontal
let data = detector.process(&rgb_frame); let data = detector.process(&rgb_frame);
println!("received {} landmarks", data.len());
highgui::imshow(window, &mut rgb_frame)?; highgui::imshow(window, &mut rgb_frame)?;
println!("LANDMARK: {} {} {}", data[0].x, data[0].y, data[0].z);
if data.len() > 0 {
println!("LANDMARK: {} {} {}", data[0].x, data[0].y, data[0].z);
}
} else { } else {
println!("WARN: Skip empty frame"); println!("WARN: Skip empty frame");
} }
@ -168,6 +179,6 @@ mod examples {
fn main() { fn main() {
// examples::pose_estimation().unwrap() // examples::pose_estimation().unwrap()
// examples::hand_tracking().unwrap() examples::hand_tracking().unwrap()
examples::face_mesh().unwrap() // examples::face_mesh().unwrap()
} }

View File

@ -107,6 +107,9 @@ impl Mediagraph {
data.rows(), data.rows(),
) )
}; };
if raw_landmarks.is_null() {
return &[];
}
let landmarks = let landmarks =
unsafe { std::slice::from_raw_parts(raw_landmarks, self.num_landmarks as usize) }; unsafe { std::slice::from_raw_parts(raw_landmarks, self.num_landmarks as usize) };
landmarks landmarks