在某些设备上,Google Mobile Visions CameraSource returns 调用 takePicture 后的低分辨率图像

On some devices, Google Mobile Visions CameraSource returns low resolution image after calling takePicture

我打电话后: cameraSource.takePicture(null, pictureCallback); 在回调中:

private CameraSource.PictureCallback pictureCallback = new CameraSource.PictureCallback() {
                @Override
                public void onPictureTaken(byte[] bytes) {
                    try {
        Log.d(DEBUG_TAG, "On picture taken.");
                        if (bytes == null) {
                            return;
                        }
                        Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
                        Glide.with(this).load(bitmap).into(capturedImg);
                    }catch (Exception ex){
                        ex.printStackTrace();
                        Log.e("PictureTaken",ex.toString());
                }
            };

创建位图时分辨率非常低 (320x240)。相机能够拍摄更高分辨率的照片。来自普通相机应用程序的大约 1600x1200。但是使用普通相机 api returns 同一相机的分辨率为 1280x720。

因此仅使用移动视觉中的 CameraSource API returns 分辨率非常低的图像。但这并不一致。它 returns 在三星平板电脑上具有高分辨率。但是当我在我的 Lenovo tab 3 上使用相同的代码时,CameraSource returns 是一个非常低分辨率的图像。可能是什么问题以及可能的解决方法?

CameraSource class 是开源的,至少是某个版本,https://github.com/googlesamples/android-vision/blob/master/visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/ui/camera/CameraSource.java。您可以自由扩展它以设置更好的图片尺寸。