Open cameronharvey92 opened 5 months ago
Dear cameronharvey92,
Thank you for the valuable information.
setTargetResolution
should be set to the default value of (640, 480),
but in the case of the Galaxy A23, it might be set to a different value, causing this issue.
We are currently considering applying a fix that involves calling setTargetResolution(640, 480)
,
but we are concerned that calling setTargetResolution
slightly reduces the detection area.
This behavior occurs on other devices as well, even when the default value of (640, 480) is specified.
Now we are considering the appropriate method, including the following ways.
1: Call setTargetResolution
only when specified as an option.
2: Solve the problem of the detection area being reduced when setTargetResolution
is called.
Regards,
Hello Cameron,
We may have found the cause. Could you please try the following and would you tell me the result?
// Call setTargetAspectRatio() instead of setTargetResolution()
ImageAnalysis imageAnalysis = new ImageAnalysis.Builder()
.setTargetAspectRatio(AspectRatio.RATIO_4_3) // <-- This line
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build();
We do not own a Galaxy A23, but we assume that the issue caused by following process:
CameraManager.getCameraCharacteristics()
)setTargetResolution()
sets the selectable resolution from the listdetection area
process seems not working correctly with 1:1 ratioI have no problem with my device Sony Xperia 10V
.
I hope it is the same with your device.
Hello there!
Using either version 1.2.0 or 1.4.0 of your library, QR codes are not detectable within the "detection area" on a Samsung Galaxy A23, running Android 14.
As per the Android quirks in the readme, this devices does not produce a distorted result, but instead actually captures a different area of the camera feed.
So it can actually detect QR codes when the
debugPreviewView
is eventually pointed at it, but it is well outside of the detection area.This seems to be an isolated device-specific issue, as similar things have been reported here and here, but I thought I would report this bug in case it wasn't. One of these links also indicates the Android version is irrelevant.
Incorrect result in portrait mode - captures an area to the top-right:![QR code not scanned - Portrait](https://github.com/monaca-plugins/monaca-plugin-barcode-scanner/assets/40044533/c0a2a624-bc08-4539-86b9-6fe5abab1ace)
Incorrect result in landscape mode - captures an area to the top-left:![QR code not scanned - Landscape](https://github.com/monaca-plugins/monaca-plugin-barcode-scanner/assets/40044533/5f919b72-60d1-47a0-ad09-a61ae5a9e329)
Proposed fix I was originally going to say that it seems the result of
BitmapUtils.getBitmap()
is incorrect, and that this device may not be supported.But for some strange reason, I was able to fix the issue simply by explicitly calling
setTargetResolution()
on theImageAnalysis.Builder
. Even random sizes seemed to work, e.g.I understand using
previewView
's resolution would make more sense, and that device rotation issues / performance issues come to mind. So this also worked:The results below look the same with either code snippet.
Either way, hopefully this issue is resolvable!
Cheers, Cameron Harvey
Correct result - Portrait:![QR code scanned - Portrait](https://github.com/monaca-plugins/monaca-plugin-barcode-scanner/assets/40044533/0993d949-dacf-4a08-8d6e-774f8013efae)
Correct result - Landscape:![QR code scanned - Landscape](https://github.com/monaca-plugins/monaca-plugin-barcode-scanner/assets/40044533/99597d9e-dc25-447a-b9ce-0f450325f3e0)