import 'dart:io'; import 'dart:ui'; import 'package:google_mlkit_object_detection/google_mlkit_object_detection.dart'; /// x double translateX(double x, InputImageRotation rotation, Size size, Size absoluteImageSize) { switch (rotation) { case InputImageRotation.rotation90deg: return x * size.width / (Platform.isIOS ? absoluteImageSize.width : absoluteImageSize.height); case InputImageRotation.rotation270deg: return size.width - x * size.width / (Platform.isIOS ? absoluteImageSize.width : absoluteImageSize.height); default: return x * size.width / absoluteImageSize.width; } } /// x /// [y] 原始坐标 double translateY(double y, InputImageRotation rotation, Size size, Size absoluteImageSize) { switch (rotation) { case InputImageRotation.rotation90deg: case InputImageRotation.rotation270deg: return y * size.height / (Platform.isIOS ? absoluteImageSize.height : absoluteImageSize.width); default: return y * size.height / absoluteImageSize.height; } }