如何使用Camera 2 API Android提高捕获的图像的质量? [英] How to increase the quality of captured image using Camera 2 API Android?

查看:176
本文介绍了如何使用Camera 2 API Android提高捕获的图像的质量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google示例创建Android相机应用.手机捕获图像后,图像质量会有所不同.相机预览比输出图像具有更好的图像质量.如何提高输出图像的质量?缩放后,预览图像和输出图像的质量差异甚至会增加.这是我的照片片段,它是

I am creating Android camera app using google sample. After the phone captures an image there is a difference of image quality. The camera preview has better image quality than the output image. How can I increase the quality of output image? After pinch zoom the difference of quality of preview image and output image even increases. This is my photo fragment and it's base class.

推荐答案

要提高图像质量,唯一的方法就是将ImageReaderSize增大到最大分辨率:

The only way you have to increase your image quality is increasing your ImageReaderSize to a biggest resolution:

mImageReader = ImageReader.newInstance(pictureSizeValue.getWidth(), pictureSizeValue.getHeight(), format, maxImages);

此外,您还可以使用CaptureRequest中的键CaptureRequest.JPEG_QUALITY来提高质量.

Also, you can improve the quality using the key CaptureRequest.JPEG_QUALITY in your CaptureRequest.

mCaptureRequestBuilder.set(CaptureRequest.JPEG_QUALITY, (byte) 100);

但是,说实话,JPEG_QUALITY值的91-100之间的差异很小,在此过程中您会得到更大的印象.您可以在此处检查质量尺寸之间的曲线:

But, to be honest, the difference between 91-100 of JPEG_QUALITY values are minimal, and you will get a bigger image in the process. You can check the curve between quality-size here:

希望它将对您有帮助!

这篇关于如何使用Camera 2 API Android提高捕获的图像的质量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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