createImageTensor static method

Tensor createImageTensor(
  1. HalideType type,
  2. int width,
  3. int height,
  4. int bytesPerChannel, {
  5. Image? image,
})

@brief create tensor with given data.

@param width image width. @param height image height. @param bytesPerChannel bytes per pixel. @param image image.

@return created tensor.

Implementation

static Tensor createImageTensor(
  HalideType type,
  int width,
  int height,
  int bytesPerChannel, {
  Image? image,
}) {
  final pImage = image == null ? ffi.nullptr : image.ptr;
  final ptr =
      c.mnn_cv_image_process_create_image_tensor(type.native.ref, width, height, bytesPerChannel, pImage);
  return Tensor.fromPointer(ptr);
}