How to increase the quality of captured image using Camera 2 API Android?

Dylan picture Dylan · Jan 23, 2017 · Viewed 7.6k times · Source

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.

Answer

Francisco Durdin Garcia picture Francisco Durdin Garcia · Jan 23, 2017

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);

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

mCaptureRequestBuilder.set(CaptureRequest.JPEG_QUALITY, (byte) 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: enter image description here

hope that it will help you!