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
947 stars 234 forks source link

Face detect don't work when video mode #209

Closed Origogi closed 1 year ago

Origogi commented 1 year ago

Steps to Reproduce

  1. run example/lib/ai_analysis_faces.dart
  2. change mode photo to video or initial mode photo to video

Expected results

working well MLkit! and show overlay face mask

Actual results

Occurred app crash

E/EventChannel#camerawesome/images( 6114): Failed to open event stream
E/EventChannel#camerawesome/images( 6114): java.lang.IllegalArgumentException: No supported surface combination is found for camera device - Id : 1.  May be attempting to bind too many use cases. Existing surfaces: [] New configs: [androidx.camera.core.impl.PreviewConfig@9f8315f, androidx.camera.core.impl.ImageAnalysisConfig@4797c75, androidx.camera.video.impl.VideoCaptureConfig@c3227ac]
E/EventChannel#camerawesome/images( 6114):  at androidx.camera.lifecycle.LifecycleCameraRepository.bindToLifecycleCamera(LifecycleCameraRepository.java:285)
E/EventChannel#camerawesome/images( 6114):  at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:538)
E/EventChannel#camerawesome/images( 6114):  at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:384)
E/EventChannel#camerawesome/images( 6114):  at com.apparence.camerawesome.cameraX.CameraXState.updateLifecycle(CameraXState.kt:112)
E/EventChannel#camerawesome/images( 6114):  at com.apparence.camerawesome.cameraX.CameraAwesomeX$setupCamera$1.invoke(CameraAwesomeX.kt:91)
E/EventChannel#camerawesome/images( 6114):  at com.apparence.camerawesome.cameraX.CameraAwesomeX$setupCamera$1.invoke(CameraAwesomeX.kt:91)
E/EventChannel#camerawesome/images( 6114):  at com.apparence.camerawesome.cameraX.CameraXState.onListen(CameraXState.kt:205)
E/EventChannel#camerawesome/images( 6114):  at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:218)
E/EventChannel#camerawesome/images( 6114):  at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:197)
E/EventChannel#camerawesome/images( 6114):  at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/EventChannel#camerawesome/images( 6114):  at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/EventChannel#camerawesome/images( 6114):  at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/EventChannel#camerawesome/images( 6114):  at android.os.Handler.handleCallback(Handler.java:938)
E/EventChannel#camerawesome/images( 6114):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/EventChannel#camerawesome/images( 6114):  at android.os.Looper.loopOnce(Looper.java:226)
E/EventChannel#camerawesome/images( 6114):  at android.os.Looper.loop(Looper.java:313)
E/EventChannel#camerawesome/images( 6114):  at android.app.ActivityThread.main(ActivityThread.java:8751)
E/EventChannel#camerawesome/images( 6114):  at java.lang.reflect.Method.invoke(Native Method)
E/EventChannel#camerawesome/images( 6114):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/EventChannel#camerawesome/images( 6114):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
W/Utils   ( 6114): could not parse long range '325-322'
I/CameraManagerGlobal( 6114): Camera 1 facing CAMERA_FACING_FRONT state now CAMERA_STATE_OPEN for client com.example.camera_app API Level 2

About your device

Brand Model OS
Samsung ** Android 12, 13

apalala-dev commented 1 year ago

We probably won't be able to help you on your specific device since the issue is related to what your device is capable of. Doing analysis and recording video is computation heavy and might not be supported by all camera devices. Here is some docs about it: https://developer.android.com/training/camerax/architecture#combine-use-cases

image

Your camera device is probably not LEVEL_3.

I'll let this open since we should provide more details about this in the docs and provide a way to find if the device supports it or not.

Can you tell us which Samsung model it is?

Origogi commented 1 year ago

Okay I will check it~ I found problem, it seems my device problem thx~, i closed issue

Origogi commented 1 year ago

@apalala-dev I find that my device did not support analayze image during record video I want to stop analayze image at a certain point (example state.contoller.stopAnalyze()) or analyze image when video recording using another method

206 seems relate this issue

apalala-dev commented 1 year ago

Yes my bad, this is the same issue as #206. There is some work to do on Analysis for a few things (including start/stop). I will take a look at what we can do.

apalala-dev commented 1 year ago

CamerAwesome 1.4.0 should address these issues.

Overall, many things have been added to the documentation, you might be interested to take a look :)

If there are other issues with image analysis, feel free to open a new issue. 👍