You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Incorrect result in landscape mode - captures an area to the top-left:
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 the ImageAnalysis.Builder. Even random sizes seemed to work, e.g.
import android.util.Size;
ImageAnalysis imageAnalysis = new ImageAnalysis.Builder()
.setTargetResolution(new Size(300, 300)) // <-- This line
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build();
imageAnalysis.setAnalyzer(executor, analyzer);
I understand using previewView's resolution would make more sense, and that device rotation issues / performance issues come to mind. So this also worked:
import android.util.Size;
int previewViewMinSize = Math.min(previewView.getWidth(), previewView.getHeight()); // <-- This line
ImageAnalysis imageAnalysis = new ImageAnalysis.Builder()
.setTargetResolution(new Size(previewViewMinSize / 2, previewViewMinSize / 2)) // <-- This line
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build();
imageAnalysis.setAnalyzer(executor, analyzer);
The results below look the same with either code snippet.
Either way, hopefully this issue is resolvable!
Cheers,
Cameron Harvey
Correct result - Portrait:
Correct result - Landscape:
The text was updated successfully, but these errors were encountered:
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.
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:
Camera devices has a list of selectable resolutions (available via CameraManager.getCameraCharacteristics())
Calling setTargetResolution() sets the selectable resolution from the list
In the Galaxy A23 case, camera default aspect ratio may be set to square (1:1)
Compared to 4:3 and 16:9, square ratio resolution is limited, so it is set to a higher resolution.
Galaxy A23 seems to be set to higher resolution and causes this issue.
Our cropping detection area process seems not working correctly with 1:1 ratio
I 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:
Incorrect result in landscape mode - captures an area to the top-left:
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:
Correct result - Landscape:
The text was updated successfully, but these errors were encountered: