8000 Brightness/Exposure/Focus control for camera plugin · Issue #24575 · flutter/flutter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Brightness/Exposure/Focus control for camera plugin #24575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
efortuna opened this issue Nov 20, 2018 · 24 comments
Closed

Brightness/Exposure/Focus control for camera plugin #24575

efortuna opened this issue Nov 20, 2018 · 24 comments
Labels
c: new feature Nothing broken; request for a new capability customer: product p: camera The camera plugin P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels.

Comments

@efortuna
Copy link
Contributor
efortuna commented Nov 20, 2018

Steps to Reproduce

  1. Run code here: https://github.com/efortuna/final_countdown (apologize in advance that this demo isn't smaller) on a physical iOS device. iOS Simulator won't take pictures. It will take a picture every 10 seconds.
  2. All the camera code is in photo_clock.dart.
  3. Look at the image generated.
  4. Now take another image using the normal camera app built in for iOS, see how much brighter the lighting is.

I don't know if there's some sort of software brightening that Apple is doing after-the-fact, or if we have some setting that's capturing badly, but I've repro'd this across three different iOS devices (iPhone 8, iPhone XS Max, iPad Air).

[✓] Flutter (Channel master, v0.11.8-pre.9, on Mac OS X 10.13.6 17G3025, locale en-US)
    • Flutter version 0.11.8-pre.9 at /Users/efortuna/flutter
    • Framework revision 921117f4d3 (20 hours ago), 2018-11-19 15:23:40 -0800
    • Engine revision 2f1b388f5a
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /Users/efortuna/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin installed
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] VS Code (version 1.29.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.20.0

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27)
      (emulator)

• No issues found!
@efortuna efortuna changed the title photos taken with the camera plugin on iOS are consistently darker than the ones taken with the camera app photos taken with the camera plugin on iOS are consistently darker than the ones taken with the built-in camera app Nov 20, 2018
@eseidelGoogle
Copy link
Contributor

This sounds like lack of EXIF or other colorspace data being recorded. :)

@eseidelGoogle
Copy link
Contributor

I've written notes about how to add exif on iOS/Android to: #10533 (comment) . I suspect all of these exif bugs are the same root cause and easy to fix.

@Hixie Hixie added severe: customer blocker customer: crowd Affects or could affect many people, though not necessarily a specific customer. customer: product labels Nov 26, 2018
@Hixie Hixie added this to the bucket11 milestone Nov 26, 2018
@efortuna
Copy link
Contributor Author
efortuna commented Nov 27, 2018

Photos taken on iOS mostly have the right illumination with checkout c319b890b33f2c15af043f2ab857e7c2944beefa. What happens is when I take a photo immediately during initState, as in this line: efortuna/final_countdown@3568783#diff-d1bd3cbe67924489f788958a5c8b8f0eR34 the photos are dark, but when taken after a delay, as in this line: efortuna/final_countdown@3568783#diff-d1bd3cbe67924489f788958a5c8b8f0eR36 they are correctly illuminated.

@goderbauer
Copy link
Member

I verified that we are writing all EXIF data we get from the iOS Camera to the picture file.

However, I noticed that you take the first picture right after the camera was initialized. Is it possible that iOS just needs a few (milli)seconds after initialization to figure out the correct exposer/etc. for the current scene? That would explain why all subsequent pictures after the first one are fine. Can you try adding a short delay before the first picture?

@efortuna
Copy link
Contributor Author

Yes, the existing behavior with c319b890b33f2c15af043f2ab857e7c2944beefa is definitely usable -- I would just argue that the camera shouldn't be saying it's "initialized" if it's not actually ready, but otherwise, I can definitely make it work. Let me know when I should switch back over to master/beta with the engine fix back in.

@goderbauer goderbauer changed the title photos taken with the camera plugin on iOS are consistently darker than the ones taken with the built-in camera app Photos taking with camera plugin right after initialize are too dark Nov 27, 2018
@Hixie
Copy link
Contributor
Hixie commented Nov 27, 2018

Does the OS tell us when it's done focusing and setting up the exposure? Or does that just continue forever? I guess I don't know when the "right" time to take a picture would be...

@goderbauer
Copy link
Member
goderbauer commented Nov 27, 2018

As far as I can tell iOS doesn't have an API to tell us when focusing and exposure is done. "done" may also be difficult to implement since it may never reach that state under difficult and constantly changing light conditions...

Please follow #10895 for the engine fix. That one is the main bug regarding the incorrect handling of EXIF data on iOS.

@goderbauer goderbauer removed customer: crowd Affects or could affect many people, though not necessarily a specific customer. severe: customer blocker labels Nov 27, 2018
@goderbauer goderbauer changed the title Photos taking with camera plugin right after initialize are too dark Brightness/Exposure/Focus control for camera plugin Nov 27, 2018
@goderbauer goderbauer added the c: new feature Nothing broken; request for a new capability label Nov 27, 2018
@goderbauer goderbauer modified the milestones: bucket11, Goals Nov 27, 2018
@goderbauer goderbauer removed their assignment Nov 27, 2018
@goderbauer
Copy link
Member

Since we have a work-around (wait a few seconds before taking the first pic) we decided to change this into a feature request for control knobs for brightness/exposure/focus/etc.

@efortuna
Copy link
8000 Contributor Author

Update -- I have a workaround for this, but I'm seeing this behavior on both iOS and Android. It seems like for whatever reason "initialize camera" is returning before the cameras are truly ready.

@zoechi zoechi added the plugin label Nov 29, 2018
@zoechi zoechi added the p: camera The camera plugin label Jan 4, 2019
@jatinmadaan8
Copy link

Anyone found the solution for Brightness/Exposure/Focus control for camera in android ?

@lhcdims
Copy link
lhcdims commented Feb 26, 2019

It is found that in Android phones, pictures/videos taken right after the camera control initialized (say within 500 ms), are very dark. My work around is: await Thread.sleep(500); after the camera control initialization and then take picture or capture video.

@Navil
Copy link
Navil commented May 7, 2019

Anyone found the solution for Brightness/Exposure/Focus control for camera in android ?

I am also looking for a solution. The image_picker plugin does also not provide options to change Brightness/Exposure/Focus/..., so taking professional pictures with flutter is currently not possible. You should thumb up this request if you are interested in the feature.

@jdeltoft
Copy link

I'm trying to scan barcodes, and it would REALLY help if the auto focus were "on" when I bring up the camera preview.

@ParsaGachkar
Copy link

any progress on auto focus ?

@BlueIcedPen
Copy link

Any progress on implementing focus control?

@gkoulomz
Copy link

I have an Android app using Camera2 API because I need to set iso (sensitivity) as well as fStop and shutter speed (i.e. I need to suppress any automatic exposure control). Am I correct in understanding that this is impossible in the flutter camera plugin?

@joshsilb
Copy link
joshsilb commented May 5, 2020

+1. Seems crazy none of these PRs are in for a fairly critical feature like this

@awaik
Copy link
awaik commented May 16, 2020

Please fix these issues, the camera uses in the huge amount of apps.

@kf6gpe kf6gpe added the P2 Important issues not at the top of the work list label May 29, 2020
@Hixie Hixie removed this from the None. milestone Aug 17, 2020
@jeffswt
Copy link
jeffswt commented Oct 14, 2020

Any improvements on the auto/manual focus feature?

@gkoulomz
Copy link

I have an app written on Android (Java) using camera2 api. When will Flutter support full exposure control (ISO, shutter speed, f-stop, white-balance)?? I would like to port to Flutter!

@gkoulomz
Copy link

Might this issue be related to the one described on stackoverflow:
https://stackoverflow.com/questions/64528631/using-android-camera2-api-even-though-all-exposure-parameters-are-the-same-dif

@mvanbeusekom
Copy link

I will be closing this issue since these features have been implemented and merged with the following PRs:

@kamleshwebtech
Copy link

I used Camera plugin and there was no inbuilt feature in package to set contrast/brightness so I have set it by ColorFiltered widget as:

ColorFiltered(
            colorFilter: const ColorFilter.mode(
              Colors.white,
              BlendMode.softLight,
              // BlendMode.overlay,
            ),
            child: CameraPreview(camController),
          )

It worked for me. I hope, this solution will also help you. Thanks a lot for asking this question.

@github-actions
Copy link
github-actions bot commented Aug 4, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability customer: product p: camera The camera plugin P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels.
Projects
None yet
0