flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
164.54k stars 27.13k forks source link

[camera] Proposal - Add support for optical image stabilization (OIS) #89525

Open ABleas opened 3 years ago

ABleas commented 3 years ago

Use case

Our requirement is for sharp, high resolution image capture. The current process uses the OS' camera app, which includes an OIS feature (iPhone 10 and 12, specifically).

There doesn't seem to be any exposure of these features in the camera package, unless I am missing something in the documentation.

Proposal

As part of the camera package, include methods to check for support of optical image stabilization, and to activate it when available.

sakyoyuto commented 1 year ago

Are there any updates?

charlieforward9 commented 1 year ago

This should also be extended for video capture.

My use case consists of a user holding the device recording an individual, and a pose detection package inferring how much the person is "swaying". The video should be as stable as possible such that the diagnosis is accurate.

Could the Flutter team please provide an update on this, and possibly provide the basis for a priority boost?

leavittx commented 1 year ago

Voting for video stabilisation. Related links: https://stackoverflow.com/a/59607821 https://source.android.com/docs/core/camera/camera-preview-stabilization

klausbreyer commented 11 months ago

video stabilisation would be great. flutter apps have such a disadvantage without it.

ZamanMalik9269 commented 10 months ago

video stabilisation would be great. flutter apps have such a disadvantage without it, Please add this feature as soon as possible

ahmedDahliz commented 7 months ago

Any updates ?

ruicraveiro commented 1 month ago

Hi,

I needed the video stabilization feature for a project, so I implemented it for iOS and Android (camerax), and I am almost ready to submit a PR (already have a draft, but I'm waiting for my corporate CLA signature to be confirmed). You can find the draft PR here: https://github.com/flutter/packages/pull/7108

The video stabilization modes are defined in the new VideoStabilizationMode enum defined in camera_platform_interface:

/// The possible video stabilization modes that can be capturing video.
enum VideoStabilizationMode {
  /// Video stabilization is disabled.
  off,

  /// Basic video stabilization is enabled.
  /// Maps to CONTROL_VIDEO_STABILIZATION_MODE_ON on Android
  /// and throws CameraException on iOS.
  on,

  /// Standard video stabilization is enabled.
  /// Maps to CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION on Android
  /// (camera_android_camerax) and to AVCaptureVideoStabilizationModeStandard
  /// on iOS.
  standard,

  /// Cinematic video stabilization is enabled.
  /// Maps to CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION on Android
  /// (camera_android_camerax) and to AVCaptureVideoStabilizationModeCinematic
  /// on iOS.
  cinematic,

  /// Extended cinematic video stabilization is enabled.
  /// Maps to AVCaptureVideoStabilizationModeCinematicExtended on iOS and
  /// throws CameraException on Android.
  cinematicExtended,
}

There is some subjectivity on the way with which I mapped the modes to both platforms, and here's a document that compares the several modes: https://docs.google.com/spreadsheets/d/1TLOLZHR5AcyPlr-y75aN-DbR0ssZLJjpV_OAJkRC1FI/edit?usp=sharing, which you can comment on.

I intend to submit the PR as soon as I have the CLA.