Function imencode

Source
pub fn imencode(
    ext: &str,
    img: &impl ToInputArray,
    buf: &mut Vector<u8>,
    params: &Vector<i32>,
) -> Result<bool>
Expand description

Encodes an image into a memory buffer.

The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description.

§Parameters

  • ext: File extension that defines the output format. Must include a leading period.
  • img: Image to be compressed.
  • buf: Output buffer resized to fit the compressed image.
  • params: Format-specific parameters. See cv::imwrite and cv::ImwriteFlags.

§C++ default parameters

  • params: std::vector()