4

I just updated my device to the latest (Leibniz) release and here are some observations/problems:

1) There are now prolonged (2-3s) intermittent periods in my App where the pose data is invalid. I assume the problem is in the driver, because the issue also occurs in the Tango Explorer. Just starting the Explorer and letting it sit there results in the "Motion Tracking Lost" dialog to pop in and out. Can anyone confirm this ?

2) The color buffer in the TangoService_connectOnFrameAvailable() callback is back now but in YUV420SP as stated in the release notes. Can anyone of the tango devs please post the code to convert this into RGB. I know I can google this stuff but it would be nice to have a sample that ties in the TangoImageBuffer width, height, stride etc.

awolfe91
  • 1,627
  • 1
  • 11
  • 11
  • 1
    I also see lost motion tracking about every 20 seconds in the Tango Explorer app. I've been told it is likely due to a mismatch between the KOT49H.150320 firmware (still Kalman) and the latest Tango Core app (Leibniz), and the hope is that it will be resolved soon with the next firmware update. – rhashimoto Apr 21 '15 at 18:26
  • As for the converter code, see [link][1]. [1]: http://stackoverflow.com/questions/29750241/tangoservice-connectonframeavailable-gets-stuck-or-crashes-using-google-tango/29794307#29794307 – Günter Westphal Apr 22 '15 at 10:19
  • yes there should be a firmware update shortly. – r4ravi2008 Apr 22 '15 at 23:31

4 Answers4

2

Quickly, here's the YUV code I used to use with Tango

// http://en.wikipedia.org/wiki/YUV
int halfi, uvOffset, halfj, uvOffsetHalfj;
float y_scaled, v_scaled, u_scaled;
const float Umax = 0.436f;
const float Vmax = 0.615f;

unsigned char* pData = TangoData::cameraImageBuffer;
unsigned char* iData = TangoData::cameraImageBufferRGBA;
float invByte = 0.0039215686274509803921568627451;  // ( 1 / 255)

is_image_dirty = false;
int size = (int)(TangoData::imageBufferStride * TangoData::imageBufferHeight);

int uOffset = size / 4 + size;
int halfstride = TangoData::imageBufferStride / 2;
for (int i = 0; i < TangoData::imageBufferHeight; ++i)
{
    halfi = i / 2;
    uvOffset = halfi * halfstride;
    for (int j = 0; j < TangoData::imageBufferWidth; ++j)
    {
        halfj = j / 2;
        uvOffsetHalfj = uvOffset + halfj;
        y_scaled = pData[i * TangoData::imageBufferStride + j] * invByte;
        v_scaled = 2 * (pData[uvOffsetHalfj + size] * invByte - 0.5f) * Vmax;
        u_scaled = 2 * (pData[uvOffsetHalfj + uOffset] * invByte - 0.5f) * Umax;
        *iData++ = (unsigned char)((y_scaled + 1.13983f * v_scaled) * 255.0);;
        *iData++ = (unsigned char)((y_scaled - 0.39465f * u_scaled - 0.58060f * v_scaled) * 255.0);
        *iData++ = (unsigned char)((y_scaled + 2.03211f * u_scaled) * 255.0);
        *iData++ = 255;
    }
}

Now, when there was the previous unannounced change to the return format, I spelunked it, changed, AND ASKED IF THIS WAS GOING TO REMAIN CONSISTENT - as usual, crickets. Then two releases ago they busted the entire image return, apparently were oblivious to it, and once again, when asked..... CRICKETS! Dear Google Devs, I really hate to say this, but this ain't my first rodeo. I started with Tango and was quite excited, but given the utter lack of communication, and the apparent mayhem within the release cycles, I have now progressed to disillusioned, and fear I may continue to utterly disgusted. I think those of us outside Google looking at AR tools may seriously need to consider other avenues. Frankly, Google Devs, if you're proud of your progress, you shouldn't be - this isn't even an A grade as a academic research project. I'm truly sorry to say this, but this has gone on way too long, and you're getting worse. Knock it off!

Mark Mullin
  • 1,340
  • 1
  • 9
  • 21
  • 1
    Thx Mark, I think this code is for YV12, but now the format is NV21; I am not sure that this is the same, but I will experiment a bit. I just haven't found the time. I share your frustrations. They should develop a simple sanity checker that calls every function in the TANGO Api and does some rudimentary validation. Before every release, run the sanity checker and have every developer make sure that their changes didn't break anything. There is only a handful of functions in the API, and a sanity checker can't be more than a few days of work. Heck, ask me and I will build one for you :) – Voxel Scanner Voxxlr Apr 20 '15 at 14:07
  • Uggh - if the format has changed, can you post converter code to the end of this thread ? – Mark Mullin Apr 20 '15 at 14:44
1

I unfortunately don't have a solution, but I'm noticing similar issues as well. I keep getting repeated Tango service exceptions in the app I'm developing, with the message "Service faulted will restart." Sometimes it does restart, other times it does not and I need to reboot the device. The pose data I end up receiving is invalid -- NaN's for the orientation, for example.

Daniel Andersen
  • 215
  • 2
  • 9
0

At the risk of sounding flippant: Try updating again.

I updated to Leibnez last week and experienced the same issue: NaNs, tango service failing, INVALID STATE codes. Tonight, I was digging into the Tango's settings trying to rollback to Jacobi. When I checked for updates, I received an "internal" OTA update message for Leibnez. This messagae looked different than the major update messages. I let it update and problem seems to be solved. I ran it for about 5 min without a failure...

My settings now report:

Build: KOT49H.150414

henderso
  • 1,035
  • 8
  • 13
0

I encountered the same problems. I use the point cloud example as a basis for programming. In the first few seconds there is no pose and additionally if you try to change view to "front view" the application crashes (because there is no pose he could change the view and position to, I guess).

You asked your question a month ago so I am curious if you have been able to capture the camera data. I use this code for the conversion from NV12 to RGB:

 int size = (int)(buffer->width * buffer->height);
 for (int i = 0; i < buffer->height; i++)
 {
   for (int j = 0; j < buffer->width; j++)
     {
     float y = buffer->data[i * buffer->stride + j];
     float u = buffer->data[size+2*((i / 2) * (buffer->stride / 2) + (j / 2))];
     float v = buffer->data[size+2*((i / 2) * (buffer->stride / 2) + (j / 2))+1];

            TangoData::GetInstance().color_buffer[3*(i*buffer->width+j)]=y;
            TangoData::GetInstance().color_buffer[3*(i*buffer->width+j)+1]=u;
            TangoData::GetInstance().color_buffer[3*(i*buffer->width+j)+2]=v;;
}
}

In the width x height the Y data is saved and after that comes the UV data, alternating. The conversion is done in the shader (quicker than in the on FrameAvailable method) with a known transformation (Android YUV format):

attribute vec4 vertex;
attribute vec3 color;
uniform mat4 mvp;
varying vec4 v_color;
void main() {
gl_PointSize = 7.0;
gl_Position = mvp*vertex;
float r=color.x + (1.370705f * (color.z-128.0f));
float g=color.x - (0.698001f * (color.z-128.0f)) - (0.377633f * (color.y-128.0f));
float b=color.x + (1.732446f * (color.y-128.0f));
v_color = vec4(r/255.0f,g/255.0f,b/255.0f,1.0);

This code doesn' fully work.

  • If I try to just capture the Y data (luminance and therefore I should get a grey image) there are just grey dots, not making sense. Moreover, there aren't black/white points just grey points with very little contrast.
  • If I add UV I just get colours in red and yellow. If I change the UV position it's all very blue. I can't detect any objects or contours.
  • After a few frames the camera crushes with the following exception (The first time the exception appears it says "RAW" instead of "YUV"):

     E/camera-metadata﹕ /home/ubuntu/jobs/redwood_internal/RedwoodInternal/Redwood/common/player-engine/‌​src/camera-metadata.cc:56 YUV failed to match frame 1545.014677
    

    -The application is very slow, needing a lot of time. I used mutex, but that didn't change anything. Has anyone solved that problem or is having it right now?

I changed the configuration a little bit, because it was said that the colour camera needs to be enabled. But I couldn't find any explanation on how this is done. I hope the following code is correct, it didn't give me any error messages:

bool TangoData::SetConfig() {

[...]

if (TangoConfig_setBool(config_, "config_enable_color_camera", true) !=
    TANGO_SUCCESS) {
  LOGE("config_enable_color_camera Failed");
  return false;
}

if (TangoConfig_setInt32(config_, "config_color_exp", 300) !=
    TANGO_SUCCESS) {
  LOGE("config_color_exp Failed");
  return false;
}

[...]
return true;
}

Hope some of this helps or you already have good results with the camera in Leibniz release!

guppy
  • 13
  • 2
  • Have you solved the "RAW/YUV failed to match frame" exception? I get it with the Furud release. I've tried threading and asynchron computation to solve this, but it doesn't help either. Any help is really appreciated! – bashbug Feb 10 '16 at 15:13