现在我拥有带两个后置摄像头的HTC Evo 3D,并计划进行一些立体视觉实验。我使用以下代码访问立体相机:
private final static int CAMERA_STEREOSCOPIC
= Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH ? 2 : 100;
camera = Camera.open(CAMERA_STEREOSCOPIC);
要访问相机预览数据:
bufferSize = mPreviewWidth * mPreviewHeight * bitsPerPixel / 8;
mPreviewBuffer = null;
// New preview buffer.
mPreviewBuffer = new byte[bufferSize + 4096];
// with buffer requires addbuffer.
camera.addCallbackBuffer(mPreviewBuffer);
camera.setPreviewCallbackWithBuffer(mCameraCallback);
private final Camera.PreviewCallback mCameraCallback = new Camera.PreviewCallback() {
public void onPreviewFrame(byte[] data, Camera c) {
// to do the camera image split processing using "data"
}
};
但是这里预览数据的大小和数据结构是什么,以及如何在相机预览代码中分割左右相机图像?
顺便说一下,我应该注意两个摄像头的预览数据的缓冲区大小吗?
有什么想法吗?提前谢谢!