Trait VideoWriterTrait

Source
pub trait VideoWriterTrait: VideoWriterTraitConst {
    // Required method
    fn as_raw_mut_VideoWriter(&mut self) -> *mut c_void;

    // Provided methods
    fn open(
        &mut self,
        filename: &str,
        fourcc: i32,
        fps: f64,
        frame_size: Size,
        is_color: bool,
    ) -> Result<bool> { ... }
    fn open_def(
        &mut self,
        filename: &str,
        fourcc: i32,
        fps: f64,
        frame_size: Size,
    ) -> Result<bool> { ... }
    fn open_with_backend(
        &mut self,
        filename: &str,
        api_preference: i32,
        fourcc: i32,
        fps: f64,
        frame_size: Size,
        is_color: bool,
    ) -> Result<bool> { ... }
    fn open_with_backend_def(
        &mut self,
        filename: &str,
        api_preference: i32,
        fourcc: i32,
        fps: f64,
        frame_size: Size,
    ) -> Result<bool> { ... }
    fn open_1(
        &mut self,
        filename: &str,
        fourcc: i32,
        fps: f64,
        frame_size: Size,
        params: &Vector<i32>,
    ) -> Result<bool> { ... }
    fn open_2(
        &mut self,
        filename: &str,
        api_preference: i32,
        fourcc: i32,
        fps: f64,
        frame_size: Size,
        params: &Vector<i32>,
    ) -> Result<bool> { ... }
    fn release(&mut self) -> Result<()> { ... }
    fn write(&mut self, image: &impl ToInputArray) -> Result<()> { ... }
    fn set(&mut self, prop_id: i32, value: f64) -> Result<bool> { ... }
}
Expand description

Mutable methods for crate::videoio::VideoWriter

Required Methods§

Provided Methods§

Source

fn open( &mut self, filename: &str, fourcc: i32, fps: f64, frame_size: Size, is_color: bool, ) -> Result<bool>

Initializes or reinitializes video writer.

The method opens video writer. Parameters are the same as in the constructor VideoWriter::VideoWriter.

§Returns

true if video writer has been successfully initialized

The method first calls VideoWriter::release to close the already opened file.

§C++ default parameters
  • is_color: true
Source

fn open_def( &mut self, filename: &str, fourcc: i32, fps: f64, frame_size: Size, ) -> Result<bool>

Initializes or reinitializes video writer.

The method opens video writer. Parameters are the same as in the constructor VideoWriter::VideoWriter.

§Returns

true if video writer has been successfully initialized

The method first calls VideoWriter::release to close the already opened file.

§Note

This alternative version of VideoWriterTrait::open function uses the following default values for its arguments:

  • is_color: true
Source

fn open_with_backend( &mut self, filename: &str, api_preference: i32, fourcc: i32, fps: f64, frame_size: Size, is_color: bool, ) -> Result<bool>

Initializes or reinitializes video writer.

The method opens video writer. Parameters are the same as in the constructor VideoWriter::VideoWriter.

§Returns

true if video writer has been successfully initialized

The method first calls VideoWriter::release to close the already opened file.

§Overloaded parameters
§C++ default parameters
  • is_color: true
Source

fn open_with_backend_def( &mut self, filename: &str, api_preference: i32, fourcc: i32, fps: f64, frame_size: Size, ) -> Result<bool>

@overload

§Note

This alternative version of VideoWriterTrait::open_with_backend function uses the following default values for its arguments:

  • is_color: true
Source

fn open_1( &mut self, filename: &str, fourcc: i32, fps: f64, frame_size: Size, params: &Vector<i32>, ) -> Result<bool>

Initializes or reinitializes video writer.

The method opens video writer. Parameters are the same as in the constructor VideoWriter::VideoWriter.

§Returns

true if video writer has been successfully initialized

The method first calls VideoWriter::release to close the already opened file.

§Overloaded parameters
Source

fn open_2( &mut self, filename: &str, api_preference: i32, fourcc: i32, fps: f64, frame_size: Size, params: &Vector<i32>, ) -> Result<bool>

Initializes or reinitializes video writer.

The method opens video writer. Parameters are the same as in the constructor VideoWriter::VideoWriter.

§Returns

true if video writer has been successfully initialized

The method first calls VideoWriter::release to close the already opened file.

§Overloaded parameters
Source

fn release(&mut self) -> Result<()>

Closes the video writer.

The method is automatically called by subsequent VideoWriter::open and by the VideoWriter destructor.

Source

fn write(&mut self, image: &impl ToInputArray) -> Result<()>

Writes the next video frame

§Parameters
  • image: The written frame. In general, color images are expected in BGR format.

The function/method writes the specified image to video file. It must have the same size as has been specified when opening the video writer.

Source

fn set(&mut self, prop_id: i32, value: f64) -> Result<bool>

Sets a property in the VideoWriter.

§Parameters
  • propId: Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) or one of [videoio_flags_others]

  • value: Value of the property.

§Returns

true if the property is supported by the backend used by the VideoWriter instance.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§