getImageRotationForCrop method

InputImageRotation getImageRotationForCrop(
  1. CameraController cameraController
)

Returns the image rotation for cropping, which may differ from the ML Kit rotation.

This is necessary because the front camera sensor on iOS is oriented at 270 degrees but the image itself is already in portrait. The rotation is adjusted accordingly.

Implementation

InputImageRotation getImageRotationForCrop(
  CameraController cameraController,
) {
  if (Platform.isIOS) return InputImageRotation.rotation0deg;

  return getRotation(cameraController);
}