Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Camera takePicture is using Previews small buffer

I am developing a project using OPENCV. I have some process on onCameraFrame. While it shows previews, user can take a photo. But in some devices, I take an error after called 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's size is my frame size, 460800. I logged frame size at onCameraFrame . Every frame's sizes are 460800. As far as I understand, takePicture tries to use previews buffer. And theirs sizes are different.

like image 997
atasoyh Avatar asked May 21 '13 08:05

atasoyh


2 Answers

I solved that kind of problem. It seems that on Android 2.2.1 you do have to set camera parameters BEFORE you call

camera.startPreview()

However on later systems like Android 3.2.1 this is no longer an issue (however it could be vendor specific).

like image 81
RINK Avatar answered Nov 12 '22 22:11

RINK


I solved my problem. I set buffer size to Picture Size. But preview started ridiculous behavior like on some devices not continue preview after takepicture,... For this reason, When I push retake or back button, I close and restart preview.

like image 23
atasoyh Avatar answered Nov 12 '22 22:11

atasoyh