Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
957 stars 245 forks source link

Image stream from camera preview and not image analysis #358

Open Frayo44 opened 1 year ago

Frayo44 commented 1 year ago

Proposal

Currently there the only option to access the camera frames is from the image analysis. This is sometimes problematic because it changes the camera resolution. I want to get a image stream that is the exactly the same as the preview.

g-apparence commented 1 year ago

Hi, on Android analysis stream and preview are two different channels. We can't specify resolution and aspect ratio. For better performance we provided dimensions but aspect ratio could be better for some cases. You can get more infos here https://developer.android.com/training/camerax/analyze

Another solution could be to move the preview in a cover mode at the exact same position as the analysis stream once we know it's aspect ratio.

Frayo44 commented 1 year ago

@g-apparence why not providing an option to startImageStream as flutter camera did?

g-apparence commented 1 year ago

We choosed on camerAwesome to handle all those boilerplate for you. This means that we start the analysis stream just when camera as init all the requirements and others.

Your first question was about the difference between preview and images provided in analysis, so I'm a bit confused now. What a startImageStream method change for you?

Frayo44 commented 1 year ago

Thanks for the response! :)

Currently setting imageAnalysisConfig makes the resolution and ratio of the image after capturing to be different from what is seen in the preview. Do you know any solution for that? I want to take pictures at max resolution available but access the frame stream at low resolution. I don't mind reducing it on the fly after receiving them but it is important that what is seen in the preview will be what is captured by the camera and what received by the analysis stream.

I tried to use camera plugin by flutter team that exposes startImageStream. It gives images that is the same as seen in the preview but unfortunately it does not support capturing images while accessing the stream as written here.

g-apparence commented 1 year ago

I've a partial fix to this. But this changes a lot the preview implementation. So for now I would not push this. As on Android preview and imageanalysis are different, my idea is to make a zoom on the preview according to the image analysis ratio. The problem is that I don't really know how Android align the analysis image from the preview.

Nashev commented 1 month ago

Could You publish it in form of PR, and immediately decline it? It can be helpful for forks or further thinking...