简体   繁体   English

将框架保存到文件onFrameAvailable [Google Project Tango]

[英]Save frames to file onFrameAvailable [Google Project Tango]

I am trying to save to files the RGB frames along with Pose data, and then do some post processing on them. 我正在尝试将RGB帧以及Pose数据保存到文件中,然后对它们进行一些后期处理。 The main issue is that currently the only way to do this using the Tango Java API is to render to a GLSurfaceView , by connecting them via 主要问题是,当前使用Tango Java API进行此操作的唯一方法是通过将它们连接到GLSurfaceView进行渲染

tangoCameraPreview.connectToTangoCamera(mTango,TangoCameraIntrinsics.TANGO_CAMERA_COLOR);

Then you would use GlReadPixels to read the pixels into an array and save that to a file. 然后,您将使用GlReadPixels将像素读取到数组中并将其保存到文件中。

The problem with this is that GlReadPixels is slow . 问题在于GlReadPixels 速度 In fact, using this I am getting about 3-4 fps using what I just described. 实际上,使用我刚刚描述的内容,我的速度约为3-4 fps。

Looking at other, more general answers on taking a photo bursts, I have seen various people saying that when using SurfaceView instead of GlSurfaceView , they managed to get up to 15fps. 看看其他一些关于连拍的更一般答案,我已经看到很多人说,当使用SurfaceView而不是GlSurfaceView ,他们设法达到了15fps。

I didn't find any way to use SurfaceView with the tango camera, since connectToTangoCamera needs a GlSurfaceView and I can't just use Camera and bind that to a SurfaceView because when I'm trying to open it (via Camera.open() ), it's already being used by Tango . 我没有找到将GlSurfaceView相机与SurfaceView一起使用的任何方法,因为connectToTangoCamera需要一个GlSurfaceView而且我不能只使用Camera并将其绑定到SurfaceView因为当我尝试打开它时(通过Camera.open() ),它已经被Tango Tango needs to use it in order to get the colorToIMUPose data. Tango需要使用它来获取colorToIMUPose数据。

So I'm really not sure what workaround might I find in order to be able to get at least 10fps. 因此,我真的不确定为找到至少10fps的帧能找到什么解决方法。

You could use the C++ API with TangoService_connectOnFrameAvailable where you will get a YUV frame buffer in a reasonable speed. 您可以将C ++ API与TangoService_connectOnFrameAvailable一起使用,在此处您将以合理的速度获得YUV帧缓冲区。 Checkout the tango c example video-overlay-jni-example where they do the RGB conversion. 检出探戈示例video-overlay-jni-example ,在其中进行RGB转换。 I use this way to interface OpenCV filters to the rendering process. 我使用这种方式将OpenCV过滤器连接到渲染过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM