markusfisch / BinaryEye

Yet another barcode scanner for Android
https://play.google.com/store/apps/details?id=de.markusfisch.android.binaryeye
MIT License
1.47k stars 121 forks source link

Support for several rear Lenses. #341

Open DienoX opened 1 year ago

DienoX commented 1 year ago

Hi, thank you very much for creating a good app.

Could you add support for multiple rear lenses? If I understand correctly, currently when zooming in, we simply enlarge the image digitally by cropping.

It would be nice if BinaryEye had similar behavior as the system camera. Currently, depending on the zoom, it switches the lens to a more optimal one. I wonder if there is a publicly available Android API that offers this.

The purpose of the function is simple, fast, convenient and effective scanning of codes from near and far.

markusfisch commented 1 year ago

Hi, and thank you for using it!

Short answer: the app may already use different lenses because zooming is done by the Android Camera API.

Long answer: It's complicated 😉 Depending on the camera driver of your specific device, and your version of Android, zooming can seamlessly change lenses. I can see this on a Pixel 7 Pro for instance. But other devices may not do this automatically.

Also, Binary Eye is deliberately still using the legacy Android Camera API to support old devices. Since API level 21, there's a new Camera2 API which allows opening more than one camera (read lens) at a time. But this Camera2 API still very often is just a wrapper around the legacy Camera API and doesn't offer more features then. Device manufacturers are slow to adopt this new API, unfortunately. With this new Camera2 API it would be possible, if supported, to seamlessly change between cameras manually. I have done this in other apps recently.

What device do you have and are you sure the lenses aren't already changed when zooming in? Quite often you can see this when the perspective is changing a little bit while zooming in.

DienoX commented 1 year ago

I am using samsung galaxy s20 with android 13. The system is official provided by Samsung. It seems to me that it definitely supports the camera API version 2. I can't see the lens change in the BinaryEye app when zooming in. When using the system camera application, you can see the moment of switching the lens by the application quite well. I can attach a video if needed.

DienoX commented 1 year ago

Below are comparison videos between BinaryEye and the Samsung camera system app. https://youtu.be/-Yk9ILphA14 https://youtube.com/shorts/-Yk9ILphA14?feature=share In these materials you can see a huge difference in zoom quality between the two applications.

I even did a simple test. I tried to scan the code from the same distance through BinaryEye and camera apps. BinaryEye unfortunately failed here. But what's more interesting, the codes that the camera application couldn't handle after a bit of tinkering gave advice to BinaryEye. I just took a photo with a Samsung camera and then imported the photo in BinaryEye. This was enough for BinaryEye to deal with the codes.

markusfisch commented 1 year ago

Thanks for the quick reply and the video! 👍

Well, then Samsung doesn't automatically change lenses when zooming. Interesting 🤔 Wouldn't have thought so.

Hm, I'm afraid there's no easy fix for this, unfortunately. At some point I will migrate Binary Eye to the new Camera2 API, of course. Then, Binary Eye should also be able to use all lenses when zooming. But this is quite some work, and it also would mean to drop support for old devices.

DienoX commented 1 year ago

I also thank you very much for your answer. I would like to add a few things about maintenance and security. Android 21 API was released together with Android 5.1. This version of Android was released in 2014. In a few days it will be 9 years since Android supports Camera API 2. No vendor, including open source projects, maintains security patches anymore. This is very dangerous for the usually unaware users of these devices. So much for IT security. Now let's move on to the topic of hardware. The phone after more than 9 years of use has such a weak battery that it cannot use this device as a reliable everyday device. Of course, it is possible to replace the battery, but no large manufacturer I know of offers support for replacing batteries in such old devices. The user can buy a counterfeit battery that can be very dangerous to his physical health. Having such a battery explode next to your body can be much more expensive than a new phone.

According to apilivels.com, 99.2% of currently used devices support API21. We should help those who are unaware of the threats to migrate to supported devices. Let's take care of them. Even the cheapest phones of trusted brands will be better than a 10-year-old phone. With 10-year-old phones, there is much more borrowing from recycling than from using them.

DienoX commented 1 year ago

After testing, I see that switching between lenses does not work in Motorola Edge 20 pro on Android 12.