Module cameleon::camera [−][src]
Expand description
This module contains types that is the main entry types of the Cameleon
.
Examples
use cameleon::u3v; // Enumerates all cameras connected to the host. let mut cameras = u3v::enumerate_cameras().unwrap(); if cameras.is_empty() { println!("no camera found"); return; } let mut camera = cameras.pop().unwrap(); // Opens the camera. camera.open().unwrap(); // Loads `GenApi` context. This is necessary for streaming. camera.load_context().unwrap(); // Start streaming. Channel capacity is set to 3. let payload_rx = camera.start_streaming(3).unwrap(); let mut payload_count = 0; while payload_count < 10 { match payload_rx.try_recv() { Ok(payload) => { println!( "payload received! block_id: {:?}, timestamp: {:?}", payload.id(), payload.timestamp() ); if let Some(image_info) = payload.image_info() { println!("{:?}\n", image_info); let image = payload.image(); // do something with the image. // ... } payload_count += 1; // Send back payload to streaming loop to reuse the buffer. This is optional. payload_rx.send_back(payload); } Err(_err) => { continue; } } } // Closes the camera. camera.close().unwrap();
Structs
Camera | Provides easy-to-use access to a |
CameraInfo | Information of the camera. |
Traits
DeviceControl | This trait provides operations on the device’s memory. |
PayloadStream | This trait provides streaming capability. |