Skip to content

imdecodeWithMetadata

Image codecsfunctionOpenCV 5.0.0
import { imdecodeWithMetadata } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSbuf, metadataTypes, metadata, flags
FUNCTIONimdecodeWithMetadata
RETURN TYPEMat
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Reads an image from a memory buffer and extracts associated metadata.

This function decodes an image from the specified memory buffer. 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.

imdecodeWithMetadata(buf: Mat, metadataTypes: IntVector, metadata: MatVector, flags: number): Mat;
buf

Input array or vector of bytes containing the encoded image data.

metadataTypes

Output destination, filled by the native operation. Output vector with types of metadata chucks returned in metadata, see cv::ImageMetadataType

metadata

Output destination, filled by the native operation. Output vector of vectors or vector of matrices to store the retrieved metadata

flags

Flag that can take values of cv::ImreadModes.

Returns

The decoded image as a cv::Mat object. If decoding fails, the function returns an empty matrix. Release returned native handles with using or delete(), including handles nested in results.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.