摄像头捕捉没有preVIEW中的Android 2.2 [英] Camera Capture Without Preview in Android 2.2
问题描述
我有一个要求,以捕捉图像,而不显示preVIEW .. 我想这样做在后台即服务。
I have a requirement to Capture the image without showing the Preview.. And i want to do it in the Background as a Service.
是否有可能做到这一点?
Is it possible to do that??
推荐答案
这是可能实现的。 应该定义处理Camera对象的一类,在上Camera.open()和这样的电话。 不提供相机对象以下行以禁用preVIEW -
It is possible to achieve. You should define a class that handles the Camera object, as in calls on Camera.open() and such. Don't provide the camera object with the following lines in order to disable the preview -
mCamera.setPreviewDisplay(mTargetHolder);
其中, mTargetHolder
是SurfaceView。
Where mTargetHolder
is the SurfaceView.
如果你想接收帧回调可以实现相机。previewCallback接口。
If you want to receive frame callbacks you can implement the Camera.PreviewCallback interface.
现在你camera.start preVIEW调用()之前注册,您使用set previewCallbackWithBuffer(相机。previewCallback)回调处理程序。 摄像机参考
Now before you call on camera.startPreview() register you callback handler using setPreviewCallbackWithBuffer(Camera.PreviewCallback). Camera reference
随着你,你可以做你想做什么都回调接收此帧数据。只记得,这是一个原始数据格式。 另请参见Camera.PictureCallback使用,如果你想拍摄一张照片。
With this frame data you receive from the callback you can do what ever you want. just remember that it is a raw data format. See also Camera.PictureCallback usage if you wish to take a picture.
我希望这有助于。 (即使不相关)
I hope this helps. (even if not relevant)
干杯
这篇关于摄像头捕捉没有preVIEW中的Android 2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!