Future<dynamic> WarpPerspective() async {
Uint8List image = widget.file.readAsBytesSync();
List<dynamic> sourcepoints = [
tl_x,
tl_y,
tr_x,
tr_y,
bl_x,
bl_y,
br_x,
br_y
];
double tld_x = widget.tl.dx;
double tld_y = widget.tl.dy;
double trd_x = widget.tr.dx;
double trd_y = widget.tr.dy;
double bld_x = widget.bl.dx;
double bld_y = widget.bl.dy;
double brd_x = widget.br.dx;
double brd_y = widget.br.dy;
List<dynamic> destinationpoints = [
tld_x,
tld_y,
trd_x,
trd_y,
bld_x,
bld_y,
brd_x,
brd_y
];
List<double> size = [100.0, 200.0];
print(sourcepoints);
print(destinationpoints);
var bytesArray = await ImgProc.warpPerspectiveTransform(image,
sourcePoints: sourcepoints,
destinationPoints: destinationpoints,
outputSize: size);
setState(() {
bytes = bytesArray;
});
return await bytesArray;
}