Open stoff99 opened 1 year ago
Short update:
here is my final solution for now which i implemented in the code behind class:
if (DeviceInfo.Current.Platform == DevicePlatform.Android) { CameraView.WidthRequest = CameraView.HeightRequest = 150; CameraView.Scale = 4; } else { CameraView.VerticalOptions = CameraView.HorizontalOptions = LayoutOptions.Fill; }
So this is now working with simple QR-Codes as well as advanced once.
This is one complex one where also this solution is not working at all on a bit older/cheeper devices:
What i did now is to past the content of this complex qr-code into a file and place it on server side. Than i created a qr-code with a url inside targeting to this file on the server.
Hey @hjam40,
i implemented you project and first of all i want to say thx for this great lib.
I use it for qr code detection and on iOS this works perfectly. As i switched to android, i was not able to detect qr-code or more or less it took very long. I also found this older issue already: https://github.com/hjam40/Camera.MAUI/issues/27
I know you just send the images to the ZXing lib. The main problem is the size of the camera image on android. I played around with the parameters like BarCodeDetectionFrameRate and BarCodeDetectionMaxThreads but i don't get a good result about detection timing. Than i try tp set the cameraview size to 150x150 and it works much better and faster. But to be honest, to show such a small viewport inside a mobile application looks a bit "broken".
Than i set the scale property on the cameraView like
<cv:CameraView x:Name="CameraView" Grid.Row="1" Grid.Column="0" BarcodeDetected="CameraView_OnBarcodeDetected" CamerasLoaded="CameraView_OnCamerasLoaded" WidthRequest="150" HeightRequest="150" BarCodeDetectionEnabled="True" BarCodeDetectionFrameRate="10" BarCodeDetectionMaxThreads="10" BarCodeOptions="{Binding BarCodeOptions}" Scale="4"/>
With this solution, the CameraView is again bigger and sharp as like you set it with fullscreen, but the performance in detecting the qr-code is like the 150x150 solution.
My question now is, do i miss something or can you confirm that when you set the cameraView on full screen or even half of the screen, the detection takes forever?
The problem with the scale is that it want fill the screen on bigger screens or is cut off on smaller screens.
Maybe the whole thing could be fixed if you would provide a property to set size of the images which are sent to ZXing?
Thx a lot Stefan