Closed itsgm closed 1 year ago
2.1.1不行,我回退到1.1.9版本用了,难道是camerax的问题么
这个问题解决了么
2.0.3也不行
Realme Q5手机上,2.x都识别不了,回退到1.1.9可以了。
VIVO Y31s 也无法扫描
原因:ImageAnalyzer 解析Y数据时出现了异常,在某些手机上,remaining() 方法返回的是字节数组的容量,而不是实际大小
ByteBuffer buffer = image.getPlanes()[0].getBuffer(); byte[] data = new byte[buffer.remaining()]; buffer.get(data);
改为如下方式
int width = image.getWidth(); int height = image.getHeight(); ByteBuffer yBuffer = image.getPlanes()[0].getBuffer(); int numPixels = (int) (width height ImageFormat.getBitsPerPixel(ImageFormat.YUV_420_888) / 8); byte[] data = new byte[numPixels]; int index = 0; int yRowStride = image.getPlanes()[0].getRowStride(); int yPixelStride = image.getPlanes()[0].getPixelStride(); for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { data[index++] = yBuffer.get(y yRowStride + x yPixelStride); } }
没有相关机型来进行测试验证;麻烦更新至当前最新版本 2.4.0 试试,看是否还存在此问题?
在oppo A32上验证没有问题了
您发送的邮件我已收到。
在oppo A32上验证没有问题了
感谢验证
2.1.1之前的版本可以识别,整个demo的扫码都无法识别