imdecode reads an image from a buffer in memory.
The function imdecode reads an image from the specified buffer in memory.
If the buffer is too short or contains invalid data, the function
returns an empty matrix.
@param buf Input array or vector of bytes.
@param flags The same flags as in cv::imread, see cv::ImreadModes.
For further details, please see:
https://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga26a67788faa58ade337f8d28ba0eb19e
IMEncode encodes an image Mat into a memory buffer.
This function compresses the image and stores it in the returned memory buffer,
using the image format passed in in the form of a file extension string.
read an image from a file into a Mat.
The flags param is one of the IMReadFlag flags.
If the image cannot be read (because of missing file, improper permissions,
unsupported or invalid format), the function returns an empty Mat.