yanshouwang / camerax

A camera plugin for flutter, which use CameraX on Android, native API on iOS, supports camera preview, capture and analyze.
MIT License
26 stars 15 forks source link

background executor for image Processes #16

Open henrik-schiller opened 2 months ago

henrik-schiller commented 2 months ago

On both Android and iOS sides, the UI is blocked if the image processes are heavy. They need to be shifted to a background thread. Simply change executor on Android to background executor.

yanshouwang commented 2 months ago

On both Android and iOS sides, the UI is blocked if the image processes are heavy. They need to be shifted to a background thread. Simply change executor on Android to background executor.

I'm sorry that I am focused on another plugin these days, this plugin need a complete rewrite in the future, I sugget to use the official camera plugin for now.

henrik-schiller commented 2 months ago

I mean, big thanks for making your code public! :) Generally, it's not possible to use the official camera plugin for image analysis because message channels are not made for huge data transfers like stream of images, and there is a memory leak when trying so. For robust image analysis, your approach of doing the image analysis natively and sending the results to Flutter is the way to go, rather than doing the analysis on the Dart side. So I'm sure there is a need for a computer vision-only package in the future. Could you do me a favor and tell me what other issues you had with this plugin? Generally, I would shift the torch logic out of the plugin to keep it more minimal because there is already a torchlight plugin by Flutter. Best regards, Henrik.

yanshouwang commented 2 months ago

I mean, big thanks for making your code public! :) Generally, it's not possible to use the official camera plugin for image analysis because message channels are not made for huge data transfers like stream of images, and there is a memory leak when trying so. For robust image analysis, your approach of doing the image analysis natively and sending the results to Flutter is the way to go, rather than doing the analysis on the Dart side. So I'm sure there is a need for a computer vision-only package in the future. Could you do me a favor and tell me what other issues you had with this plugin? Generally, I would shift the torch logic out of the plugin to keep it more minimal because there is already a torchlight plugin by Flutter. Best regards, Henrik.

I need to rewrite it use pigeon or ffi and the image analysis mechanism need to be reconsidered.