TakePicture Android camera uses small buffer preview

I am developing a project using OPENCV. I have some process on onCameraFrame. While it shows a preview, the user can take a picture. But on some devices, I accept the error after calling the takePicture (...) method. What should I do?

E/Camera-JNI(11783): Manually set buffer was too small! Expected 539380 bytes, but got 460800! 

new symptom: this buffer size is my frame size, 460800. I registered the frame size on onCameraFrame. Each frame size is 460800. As far as I understand, takePicture is trying to use the preview buffer. And their sizes are different.

+7
source share
2 answers

I solved my problem. I set the buffer size to Image Size. But the preview started a ridiculous behavior, as on some devices that do not continue viewing after takepicture, ... For this reason, when I press the return or return button, I close and restart the preview.

+1
source

I solved this problem. It looks like on Android 2.2.1 you need to set the camera parameters before you call

 camera.startPreview() 

However, on later systems such as Android 3.2.1, this is no longer a problem (however, it may be vendor specific).

+1
source

All Articles