在某些设备上,Google Mobile Visions CameraSource在调用takePicture后返回低分辨率图像 [英] On some devices, Google Mobile Visions CameraSource returns low resolution image after calling takePicture

查看:111
本文介绍了在某些设备上,Google Mobile Visions CameraSource在调用takePicture后返回低分辨率图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

After I call: cameraSource.takePicture(null, pictureCallback); in the callback:

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.但是使用普通的Camera api可以为同一台摄像机返回1280x720的分辨率.

When the bitmap is created the resolution is very low (320x240). The camera is capable of taking higher resolution photos. around 1600x1200 from the normal camera app. But using the normal Camera api returns a resolution of 1280x720 for the same camera.

因此,仅使用来自Mobile Vision API的CameraSource会返回非常低分辨率的图像.但这并不一致.它在三星平板电脑上返回高分辨率.但是,当我在Lenovo选项卡3上使用相同的代码时,CameraSource返回的分辨率非常低.可能是什么问题以及可能的解决方法?

So only using the CameraSource from the Mobile Vision API returns a very low resolution image. But this is not consistent. It returns a high resolution on samsung tablets. But when I used the same code on my Lenovo tab 3, CameraSource returns a very low resolution image. What could be the problem and the possible fix?

推荐答案

CameraSource类是开源的,至少是某些版本,

CameraSource class is open source, at least some version if it, 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. You are free to extend it to set better picture size.

这篇关于在某些设备上,Google Mobile Visions CameraSource在调用takePicture后返回低分辨率图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆