[][src]Function opencv::imgcodecs::imdecode

pub fn imdecode(buf: &dyn ToInputArray, flags: i32) -> Result<Mat>

Reads an image from a buffer in memory.

The function imdecode reads an image from the specified buffer in the memory. If the buffer is too short or contains invalid data, the function returns an empty matrix ( Mat::data==NULL ).

See cv::imread for the list of supported formats and flags description.

Note: In the case of color images, the decoded images will have the channels stored in B G R order.

Parameters

  • buf: Input array or vector of bytes.
  • flags: The same flags as in cv::imread, see cv::ImreadModes.