Struct nokhwa::backends::capture::V4LCaptureDevice [−][src]
pub struct V4LCaptureDevice<'a> { /* fields omitted */ }
Expand description
The backend struct that interfaces with V4L2.
To see what this does, please see CaptureBackendTrait
Quirks
- Calling
set_resolution()
,set_framerate()
, orset_frameformat()
each internally callsset_camera_format()
.
Implementations
impl<'a> V4LCaptureDevice<'a>
[src]
impl<'a> V4LCaptureDevice<'a>
[src]pub fn new(
index: usize,
cam_fmt: Option<CameraFormat>
) -> Result<Self, NokhwaError>
[src]
pub fn new(
index: usize,
cam_fmt: Option<CameraFormat>
) -> Result<Self, NokhwaError>
[src]Creates a new capture device using the V4L2 backend. Indexes are gives to devices by the OS, and usually numbered by order of discovery.
If camera_format
is None
, it will be spawned with with 640x480@15 FPS, MJPEG CameraFormat
default.
Errors
This function will error if the camera is currently busy or if V4L2 can’t read device information.
pub fn new_with(
index: usize,
width: u32,
height: u32,
fps: u32,
fourcc: FrameFormat
) -> Result<Self, NokhwaError>
[src]
pub fn new_with(
index: usize,
width: u32,
height: u32,
fps: u32,
fourcc: FrameFormat
) -> Result<Self, NokhwaError>
[src]Create a new V4L Camera with desired settings.
Errors
This function will error if the camera is currently busy or if V4L2 can’t read device information.
pub fn inner_device(&self) -> &Device
[src]
pub fn inner_device(&self) -> &Device
[src]Get the inner device (immutable) for e.g. Controls
pub fn inner_device_mut(&mut self) -> &mut Device
[src]
pub fn inner_device_mut(&mut self) -> &mut Device
[src]Get the inner device (mutable) for e.g. Controls
Trait Implementations
impl<'a> CaptureBackendTrait for V4LCaptureDevice<'a>
[src]
impl<'a> CaptureBackendTrait for V4LCaptureDevice<'a>
[src]fn get_info(&self) -> CameraInfo
[src]
fn get_info(&self) -> CameraInfo
[src]Gets the camera information such as Name and Index as a CameraInfo
.
fn get_camera_format(&self) -> CameraFormat
[src]
fn get_camera_format(&self) -> CameraFormat
[src]Gets the current CameraFormat
.
fn set_camera_format(
&mut self,
new_fmt: CameraFormat
) -> Result<(), NokhwaError>
[src]
fn set_camera_format(
&mut self,
new_fmt: CameraFormat
) -> Result<(), NokhwaError>
[src]Will set the current CameraFormat
This will reset the current stream if used while stream is opened. Read more
fn get_compatible_list_by_resolution(
&self,
fourcc: FrameFormat
) -> Result<HashMap<Resolution, Vec<u32>>, NokhwaError>
[src]
fn get_compatible_list_by_resolution(
&self,
fourcc: FrameFormat
) -> Result<HashMap<Resolution, Vec<u32>>, NokhwaError>
[src]A hashmap of Resolution
s mapped to framerates Read more
fn get_compatible_fourcc(&mut self) -> Result<Vec<FrameFormat>, NokhwaError>
[src]
fn get_compatible_fourcc(&mut self) -> Result<Vec<FrameFormat>, NokhwaError>
[src]A Vector of compatible FrameFormat
s. Read more
fn get_resolution(&self) -> Resolution
[src]
fn get_resolution(&self) -> Resolution
[src]Gets the current camera resolution (See: Resolution
, CameraFormat
).
fn set_resolution(&mut self, new_res: Resolution) -> Result<(), NokhwaError>
[src]
fn set_resolution(&mut self, new_res: Resolution) -> Result<(), NokhwaError>
[src]Will set the current Resolution
This will reset the current stream if used while stream is opened. Read more
fn get_framerate(&self) -> u32
[src]
fn get_framerate(&self) -> u32
[src]Gets the current camera framerate (See: CameraFormat
).
fn set_framerate(&mut self, new_fps: u32) -> Result<(), NokhwaError>
[src]
fn set_framerate(&mut self, new_fps: u32) -> Result<(), NokhwaError>
[src]Will set the current framerate This will reset the current stream if used while stream is opened. Read more
fn get_frameformat(&self) -> FrameFormat
[src]
fn get_frameformat(&self) -> FrameFormat
[src]Gets the current camera’s frame format (See: FrameFormat
, CameraFormat
).
fn set_frameformat(&mut self, fourcc: FrameFormat) -> Result<(), NokhwaError>
[src]
fn set_frameformat(&mut self, fourcc: FrameFormat) -> Result<(), NokhwaError>
[src]Will set the current FrameFormat
This will reset the current stream if used while stream is opened. Read more
fn open_stream(&mut self) -> Result<(), NokhwaError>
[src]
fn open_stream(&mut self) -> Result<(), NokhwaError>
[src]Will open the camera stream with set parameters. This will be called internally if you try and call get_frame()
before you call open_stream()
. Read more
fn is_stream_open(&self) -> bool
[src]
fn is_stream_open(&self) -> bool
[src]Checks if stream if open. If it is, it will return true.
fn get_frame(&mut self) -> Result<ImageBuffer<Rgb<u8>, Vec<u8>>, NokhwaError>
[src]
fn get_frame(&mut self) -> Result<ImageBuffer<Rgb<u8>, Vec<u8>>, NokhwaError>
[src]Will get a frame from the camera as a Raw RGB image buffer. Depending on the backend, if you have not called open_stream()
before you called this,
it will either return an error. Read more
fn get_frame_raw(&mut self) -> Result<Vec<u8>, NokhwaError>
[src]
fn get_frame_raw(&mut self) -> Result<Vec<u8>, NokhwaError>
[src]Will get a frame from the camera without any processing applied, meaning you will usually get a frame you need to decode yourself. Read more
fn stop_stream(&mut self) -> Result<(), NokhwaError>
[src]
fn stop_stream(&mut self) -> Result<(), NokhwaError>
[src]Will drop the stream. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for V4LCaptureDevice<'a>
impl<'a> Send for V4LCaptureDevice<'a>
impl<'a> Sync for V4LCaptureDevice<'a>
impl<'a> Unpin for V4LCaptureDevice<'a>
impl<'a> !UnwindSafe for V4LCaptureDevice<'a>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T