Open sbricchi opened 5 months ago
Hi,
I suggest this additional code in order to get a good detection :
1- Add a constructor to handle orientation change :
public CameraManager()
{
DeviceDisplay.MainDisplayInfoChanged += DeviceDisplay_MainDisplayInfoChanged;
}
2- Update camera on orientation change :
private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
{
if (cameraPreview != null) UpdateCamera();
}
3- Unregister event in Dispose :
public void Dispose()
{
DeviceDisplay.MainDisplayInfoChanged -= DeviceDisplay_MainDisplayInfoChanged;
cameraExecutor?.Shutdown();
cameraExecutor?.Dispose();
}
4- Configure camera preview with the same settings of the image analyzer :
cameraPreview = new AndroidX.Camera.Core.Preview.Builder()
.SetDefaultResolution(new Android.Util.Size(640, 480))
.SetIsRgba8888SurfaceRequired(true)
.Build();
cameraPreview.SetSurfaceProvider(previewView.SurfaceProvider);
Regards.
@sbricchi @Eskissimo Any idea when these changes will be merged into master? Thanks
@Redth Can you take a look?
This change allows to detect codes in some Android device models that seems to report a different image format to the expected by this plugin. You can find the solution and the problem explanation by https://github.com/gyaccuzzi at this issue: https://github.com/Redth/ZXing.Net.Maui/issues/107
It's proven to add image recognition for these devices:
Motorola G82 Motorola G30 Motorola G5 (oldie) Samsung A23
I can guess that it fixes many other models . I'm not sure if changing the image scanning format could create any other kind of performance issues.