I am using the flutter package document_scanner_flutter 0.2.5. I would like to edit the "Convert to Black & White" function - it is far to aggressive, shadow is converted to all black.
I can not seem to find this exact function with in the package.
I would like to update the "B & W" function with code below (But I can not seem to find it).
static Future<Uint8List?> eco(Uint8List picture) async {
final appDir = await getTemporaryDirectory();
File pictureFile = File('${appDir.path}/image_open_cv.jpg');
await pictureFile.writeAsBytes(picture);
var res = await Cv2.gaussianBlur(
pathFrom: CVPathFrom.GALLERY_CAMERA,
pathString: pictureFile.path,
kernelSize: [3, 3],
sigmaX: 0,
);
if (res == null) return null;
await pictureFile.writeAsBytes(res);
res = await Cv2.adaptiveThreshold(
pathFrom: CVPathFrom.GALLERY_CAMERA,
pathString: pictureFile.path,
maxValue: 255,
adaptiveMethod: Cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
thresholdType: Cv2.THRESH_BINARY,
blockSize: 7,
constantValue: 2,
);
if (res == null) return null;
await pictureFile.writeAsBytes(res);
res = await Cv2.medianBlur(
pathFrom: CVPathFrom.GALLERY_CAMERA,
pathString: pictureFile.path,
kernelSize: 3,
);
return res;
}
Can anyone help me find and replace the "B&W" function/method with in the package? Thanks.