Compare commits
No commits in common. "a23b117752f71e38170db931c792770071a180bf" and "031c4bb7c899b537b45614f53fad254d1d72ac45" have entirely different histories.
a23b117752
...
031c4bb7c8
15
src/main.rs
15
src/main.rs
|
@ -23,12 +23,12 @@ fn main() {
|
|||
let app = App::default();
|
||||
let mut camera_window = Window::new(0, 0, 400, 400, "Camera Video Output Window");
|
||||
let mut camera_frame = Frame::default_fill();
|
||||
camera_frame.set_align(Align::Center);
|
||||
camera_frame.set_align(Align::LeftTop);
|
||||
camera_window.end();
|
||||
camera_window.show();
|
||||
let mut color_window = Window::new(0, 450, 400, 400, "Video Output Window");
|
||||
let mut color_frame = Frame::default_fill();
|
||||
color_frame.set_align(Align::Center);
|
||||
color_frame.set_align(Align::LeftTop);
|
||||
color_window.end();
|
||||
color_window.show();
|
||||
// app.run().unwrap();
|
||||
|
@ -51,7 +51,6 @@ fn main() {
|
|||
let mut w = 0;
|
||||
let mut h = 0;
|
||||
if camera_open {
|
||||
crossbeam::scope(|_| {
|
||||
loop {
|
||||
// 捕获一帧图像
|
||||
match camera.capture() {
|
||||
|
@ -64,7 +63,7 @@ fn main() {
|
|||
w = l_data.width() as i32;
|
||||
h = l_data.height() as i32;
|
||||
}
|
||||
|
||||
crossbeam::scope(|_| {
|
||||
for tmp_x in 0..30 {
|
||||
for tmp_y in 0..60 {
|
||||
rgb_data.put_pixel(tmp_x, tmp_y, Rgb([102, 204, 255]));
|
||||
|
@ -78,7 +77,9 @@ fn main() {
|
|||
color_frame.redraw();
|
||||
let duration = start.elapsed();
|
||||
println!("L8 Frame Draw use time: {:?}", duration);
|
||||
|
||||
})
|
||||
.unwrap();
|
||||
crossbeam::scope(|_| {
|
||||
let fltk_l_image =
|
||||
RgbImage::new(l_data.as_raw(), w, h, ColorDepth::L8).unwrap();
|
||||
camera_frame.set_image(Some(fltk_l_image));
|
||||
|
@ -86,6 +87,8 @@ fn main() {
|
|||
camera_frame.redraw();
|
||||
let duration = start.elapsed();
|
||||
println!("RGB8 Frame Draw use time: {:?}", duration);
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("捕获错误: {}", e);
|
||||
|
@ -94,8 +97,6 @@ fn main() {
|
|||
}
|
||||
app.wait();
|
||||
}
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue