imread function

Mat imread(
  1. String filename, {
  2. int flags = IMREAD_COLOR,
})

IMRead reads 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.

For further details, please see: http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56

Implementation

Mat imread(String filename, {int flags = IMREAD_COLOR}) {
  return cvRunArena<Mat>((arena) {
    final p = calloc<cvg.Mat>();
    cvRun(() => cffi.Image_IMRead(filename.toNativeUtf8(allocator: arena).cast(), flags, p));
    return Mat.fromPointer(p);
  });
}