How to make a high resolution image when measuring depth using a tango project

How to take a picture with a tango project?

I read this answer: Using onFrameAvailable () in Jacobi Google Tango API

which works to capture the frame, but the image quality is low. Is there any equivalent to takePicture?

Please note that the java API

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

does not provide rgb data. If I use the Android camera for shooting, tango cannot feel the depth. There I will have to use TangoCameraPreview.

thanks

0
source share
1 answer

You do not need to use TangoCameraPreview to get frames in Java. It’s really just a convenience class that helps you get videos on screen. It seems to be fully implemented in Java with calls to com.google.atap.tangoservice.Tango (i.e. there are no calls to the unpublished APIs). In fact, if you look at the Tango SDK jar file, you will see that someone accidentally included a version of the source file - it has some diff annotations and may not be relevant, but studying this is still instructive.

I prefer not to use TangoCameraPreview and instead call Tango.connectTextureId() and Tango.updateTexture() to load the frame pixels into the OpenGL texture, which I can then use, but I want. This is exactly what TangoCameraPreview does under the hood.

The best way to capture a frame in pure Java is to draw the texture in the exact size (1280x720) to the off-screen buffer and read it back. It also has the side effect of texture conversion from any YUV format it has in RGB (which may or may not be desirable). In OpenGL ES, you do this with framebuffer and renderbuffer .

Adding framebuffer / renderbuffer material to a program that can already display on the screen does not have much code - about the same level as saving the file, but it is difficult to do this when you do it for the first time. I created an application for Android Studio , which saves the texture of Tango as a PNG to a folder with pictures (when you click on the screen) in case it is useful for everyone.

+2
source

All Articles