sobel static method

Future<Uint8List?> sobel({
  1. required CVPathFrom pathFrom,
  2. required String pathString,
  3. required int depth,
  4. required int dx,
  5. required int dy,
})

Implementation

static Future<Uint8List?> sobel({
  required CVPathFrom pathFrom,
  required String pathString,
  required int depth,
  required int dx,
  required int dy,
}) async {
  File _file;
  Uint8List _fileAssets;

  Uint8List? result;
  int depthTemp = (depth > 0) ? -1 * depth : depth;
  switch (pathFrom) {
    case CVPathFrom.GALLERY_CAMERA:
      result = await platform.invokeMethod(
        'sobel',
        {
          "pathType": 1,
          'pathString': pathString,
          "data": Uint8List(0),
          'depth': depthTemp,
          'dx': dx,
          'dy': dy,
        },
      );
      break;
    case CVPathFrom.URL:
      _file = await DefaultCacheManager().getSingleFile(pathString);
      result = await platform.invokeMethod(
        'sobel',
        {
          "pathType": 2,
          "pathString": '',
          "data": await _file.readAsBytes(),
          'depth': depthTemp,
          'dx': dx,
          'dy': dy,
        },
      );

      break;
    case CVPathFrom.ASSETS:
      _fileAssets = await Utils.imgAssets2Uint8List(pathString);
      result = await platform.invokeMethod(
        'sobel',
        {
          "pathType": 3,
          "pathString": '',
          "data": _fileAssets,
          'depth': depthTemp,
          'dx': dx,
          'dy': dy,
        },
      );
      break;
  }
  return result;
}