mlkit icon indicating copy to clipboard operation
mlkit copied to clipboard

[BarcodeScanner] CameraX poor performance vs Camera1

Open garciacastano09 opened this issue 3 years ago • 6 comments

Hi all,

First, thank you for the great sample app, it really accelerates learning.

I was running the sample app with the barcode scanner, and I noticed that the LivePreviewActivity has a much better performance than the CameraXLivePreviewActivity. I'm interested on implementing a similar barcode scanning approach, and I'm concerned about using the CameraX library, given the poor performance. Here are a couple screenshots from a Samsung Galaxy S8 running both activities against the same image.

What's the reason behind the performance difference? Is it a bug in the sample app or is it a performance gap between Camera1 and CameraX libraries?

Thank you, Jorge

garciacastano09 avatar Jan 13 '22 11:01 garciacastano09

Thanks for the feedback!

Which barcode scanning dependency version you're testing (com.google.mlkit:barcode-scanning:17.0.1 ?)?

I tested them locally and the performance looks similar. (resolutions are a little bit different than yours though due to the device capability, but it shouldn't mater much)

LivePreviewActivity 3stvZpXiEBRjwvx CameraXLivePreviewActivity

5943Ad4SBCVZzjT

zhouyiself avatar Jan 15 '22 00:01 zhouyiself

Yes, I'm using com.google.mlkit:barcode-scanning:17.0.1, I didn't change any dependency from the master branch. Leaving here some data on the OS I have in the device.

Screenshot_20220115-110541_Settings

garciacastano09 avatar Jan 15 '22 10:01 garciacastano09

I have tested the sample app on my Pixel 5 using the QR codes which I have found in the internet (http://qrcode.meetheed.com/qrcode_examples.php)

Unfortunately I have noticed slight, but constant performance difference between Camara1 and CamaraX api as well. https://photos.app.goo.gl/Y4XnPyi9w32psBtm8

AlexTrotsenko avatar Jan 28 '22 15:01 AlexTrotsenko

I have the same issue with [Vision Module].

I run the vision demo on xiaomi CC 9E soc: Qualcomm snapdragon 665

LivePreviewActivity: image

CameraXLivewPreviewActivity: image

So what's wrong with CameraX?

peerless2012 avatar Apr 27 '22 06:04 peerless2012

Have anyone figured out what was wrong with CameraX setup?

dreamchaser96 avatar Aug 21 '22 13:08 dreamchaser96

Any news on this ? I'm getting consistently lower performance on CameraX vs Camera1 on barcode scanning and text recognition.

0xsimulacra avatar Mar 13 '23 03:03 0xsimulacra