Search code examples
androidopencvjava-native-interfaceandroid-camera

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.


Solution

  • I solved my problem. I set the buffer size to match with the Picture Size. But with the preview, it started to show a ridiculous behavior like on some devices not to continue after taking the picture for the preview,... For this reason, When I push retake or back button, I close and restart the preview. It solves all my problems.