threshold static method
Future<Uint8List?>
threshold({
- required CVPathFrom pathFrom,
- required String pathString,
- required double thresholdValue,
- required double maxThresholdValue,
- required int thresholdType,
Implementation
static Future<Uint8List?> threshold({
required CVPathFrom pathFrom,
required String pathString,
required double thresholdValue,
required double maxThresholdValue,
required int thresholdType,
}) async {
File _file;
Uint8List _fileAssets;
Uint8List? result;
switch (pathFrom) {
case CVPathFrom.GALLERY_CAMERA:
result = await platform.invokeMethod('threshold', {
"pathType": 1,
"pathString": pathString,
"data": Uint8List(0),
'thresholdValue': thresholdValue,
'maxThresholdValue': maxThresholdValue,
'thresholdType': thresholdType
});
break;
case CVPathFrom.URL:
_file = await DefaultCacheManager().getSingleFile(pathString);
result = await platform.invokeMethod('threshold', {
"pathType": 2,
"pathString": '',
"data": await _file.readAsBytes(),
'thresholdValue': thresholdValue,
'maxThresholdValue': maxThresholdValue,
'thresholdType': thresholdType
});
break;
case CVPathFrom.ASSETS:
_fileAssets = await Utils.imgAssets2Uint8List(pathString);
result = await platform.invokeMethod('threshold', {
"pathType": 3,
"pathString": '',
"data": _fileAssets,
'thresholdValue': thresholdValue,
'maxThresholdValue': maxThresholdValue,
'thresholdType': thresholdType
});
break;
default:
_fileAssets = await Utils.imgAssets2Uint8List(pathString);
result = await platform.invokeMethod('threshold', {
"pathType": 3,
"pathString": '',
"data": _fileAssets,
'thresholdValue': thresholdValue,
'maxThresholdValue': maxThresholdValue,
'thresholdType': thresholdType
});
}
return result;
}