如何在使用项目探戈感知深度的同时获取高分辨率图像 [英] How to take high-res picture while sensing depth using project tango

查看:124
本文介绍了如何在使用项目探戈感知深度的同时获取高分辨率图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用项目探戈拍照?

How take picture using project tango ?

我读到这个答案:在Jacobi Google Tango API中使用onFrameAvailable()

用于抓取帧但图片质量不是很好。是否有任何takePicture等效?

which works for grabbing a frame but picture quality is not great. Is there any takePicture equivalent ?

注意java API

Note that java API

        public void onFrameAvailable(int cameraId) {
            if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
                mTangoCameraPreview.onFrameAvailable();
            }
        }

不提供rgb数据。如果我使用Android相机拍照,探戈无法感知深度。在那里我将不得不使用TangoCameraPreview。

does not provide rgb data. If I use android camera to take picture, tango can not sense depth. There I will have to use TangoCameraPreview.

谢谢

推荐答案

你不必使用 TangoCameraPreview 来获取Java中的帧。它实际上只是一个方便的类,以帮助在屏幕上获取视频。它似乎完全用Java实现,调用 com.google.atap.tangoservice.Tango (即不调用未发布的API)。事实上,如果您查看Tango SDK jar文件,您可以看到有人意外地包含了源文件的一个版本 - 它有一些差异注释,可能不是最新的,但检查它仍然是有益的。

You don't have to use TangoCameraPreview to get frames in Java. It is really just a convenience class provided to help with getting video on the screen. It appears to be implemented entirely in Java with calls to com.google.atap.tangoservice.Tango (i.e no calls to unpublished APIs). In fact, if you look inside the Tango SDK jar file, you can see that someone accidentally included a version of the source file - it has some diff annotations and may not be up to date but examining it is still instructive.

我不想使用 TangoCameraPreview 而是拨打 Tango.connectTextureId() Tango.updateTexture() 我自己将帧像素加载到OpenGL纹理中,然后我可以随意使用它。这正是 TangoCameraPreview 所做的。

I prefer not to use TangoCameraPreview and instead call Tango.connectTextureId() and Tango.updateTexture() myself to load frame pixels into an OpenGL texture that I can then use however I want. That is exactly what TangoCameraPreview does under the hood.

在纯Java中捕获帧的最佳方法是将纹理以其精确尺寸(1280x720)绘制到屏幕外缓冲区并将其读回。这也具有将纹理从其具有的任何YUV格式转换为RGB(这可能是也可能不是期望的)的副作用。在OpenGL ES中,您可以使用 framebuffer renderbuffer

The best way to capture a frame in pure Java is to draw the texture at its exact size (1280x720) to an offscreen buffer and read it back. This also has the side effect of converting the texture from whatever YUV format it has into RGB (which may or may not be desirable). In OpenGL ES you do this using a framebuffer and renderbuffer.

将帧缓冲区/渲染缓冲区添加到已经渲染到的程序中屏幕不是很多代码 - 与保存文件所需的数量相当 - 但是当你第一次做这件事时,要做到正确是很棘手的。我创建了一个Android Studio 样本捕获应用,它将Tango纹理作为PNG保存到图片文件夹中(当你点击屏幕)以防对任何人有帮助。

Adding the framebuffer/renderbuffer stuff to a program that can already render to the screen isn't a lot of code - about on par with the amount needed to save a file - but it is tricky to get right when you do it for the first time. I created an Android Studio sample capture app that saves a Tango texture as a PNG to the pictures folder (when you tap the screen) in case that is helpful for anyone.

这篇关于如何在使用项目探戈感知深度的同时获取高分辨率图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆