Why is the data byte array size different for onPictureTaken(byte[] data, Camera camera) and onPreviewFrame(byte[] data, Camera camera). The former has the original image and hence gives me a clean image and the latter gives me a pixelated image. I am not using onPictureTaken because it does not get triggered sometimes. If my picture size is 1600 x 1400 and screen size is 800 x 480 onPictureTaken gives me 1600 x 1400 and onPreviewFrame gives me 800 x 480
This is my code:
mCamera.setOneShotPreviewCallback(new Camera.PreviewCallback() {
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
Camera.Parameters parameters = camera.getParameters();
int format = parameters.getPreviewFormat();
//YUV formats require more conversion
if (format == ImageFormat.NV21 || format == ImageFormat.YUY2 || format == ImageFormat.NV16) {
int w = parameters.getPreviewSize().width;
int h = parameters.getPreviewSize().height;
// Get the YuV image
YuvImage yuv_image = new YuvImage(data, format, w, h, null);
}
I have been stuck with this issue for one week.
P.S. - In case of negative ratings please state the reason