Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the quality of captured image using Camera 2 API 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.

like image 525
Dylan Avatar asked Jan 23 '17 00:01

Dylan


1 Answers

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

like image 115
Francisco Durdin Garcia Avatar answered Oct 12 '22 15:10

Francisco Durdin Garcia