Skip to content

How can I display images #10

@Kofituo

Description

@Kofituo

I want to know how to decode the images. Here's what I've tried

    let camera = Camera::new_default_device();
    camera.start();

    let Some(frame) = camera.wait_for_frame() else {
        return;
    }; // always blockingly waiting for next new frame
    let (w, h) = frame.size_u32();
    camera.stop(); // or drop it}

    println!("w, h {} {}", w, h);
    let data = frame.data();
    let image = data.data_u8(); // use this buffer, per default in ARGB format
                                 // for real use cases processing or displaying frames can get more complicated when trying to be most efficient
    image::save_buffer(format!("image.jpeg"), image, w, h, image::ColorType::Rgba8).unwrap();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions