0

I'm trying to retrieve the TANGO_CAMERA_COLOR image pixel data by registering a callback function using

static void onFrameAvailable( void* context, const TangoCameraId id, const TangoImageBuffer* buffer )
{

    LOGVI( "\nGOOGLE TANGO FRAME AVAILABLE" );

}

...

if(TangoService_connectOnFrameAvailable( TANGO_CAMERA_COLOR, NULL, onFrameAvailable ) == TANGO_SUCCESS)
{
    LOGVI( "\nGOOGLE TANGO ONFRAMEAVAILABLE CONNECTED" );
}

I actually get my success log as output but the callback function is never called.

output:

01-13 12:04:02.655: I/tango_client_api(187): Tango Service: connect, internal status 0
01-13 12:04:02.655: I/VR(8529): GOOGLE TANGO CONNECTED
01-13 12:04:02.655: I/VR(8529): GOOGLE TANGO EVENT HANDLER CONNECTED
01-13 12:04:02.656: I/tango_client_api(187): Tango Service: getCameraIntrinsics, internal status 0
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE WIDTH 1280
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE HEIGHT 720
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE FOCAL X 1039.630000
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE FOCAL Y 1039.900000
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE PRINCIPAL X 634.922000
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE PRINCIPAL Y 362.981000
01-13 12:04:02.656: I/tango_client_api(187): Tango Service: connectSurface, internal status 0
01-13 12:04:02.657: I/VR(8529): GOOGLE TANGO ONFRAMEAVAILABLE CONNECTED
01-13 12:04:02.694: I/chromium(8529): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
01-13 12:04:02.823: I/Camera3-OutputStream(168): enqueue first Preview frame or first video frame
01-13 12:04:02.825: I/native-camera(187): Dropping VGA with too much latency 92240.015085 > 0.000000 + 2 * 0.033328
01-13 12:04:02.899: I/native-camera(187): VGA Stats: 3 frames, 0 locked_buffer_drops, 0 sensor_hub_drops, 1 ambiguous, 0 feature_tracking_drops
01-13 12:04:02.899: I/native-camera(187): COLOR Stats: 0 frames, 0 locked_buffer_drops, 0 sensor_hub_drops, 0 ambiguous

... what follows are only event notifications like FisheyeUnderExposed, TooFewFeaturesTracked

I'm using C-API version Descartes. The permissions in the Manifest are defined. What should be necessary for the callback to work ( init, connecting, .. )?

  • Could you provide more information from the logcat? It looks like you filtered only your application's output. – xuguo Jan 12 '15 at 19:57

2 Answers2

1

One thing worth to check is the permission. To use the color camera, you will need to add the camera permission to the manifest file.

xuguo
  • 1,816
  • 1
  • 11
  • 15
1

Try building the augmented reality C sample - I hacked it up (poorly) to do exactly this and it worked OK - AquireTangoImage gets called (I chopped the guts out cause the call happens and then I fail to update the texture :-)) - ConnectTexture is part of the original sample, I just added the secondary connectOnFrameAvailable - note that, at least in my experience, as soon as you do start getting callbacks you stop getting texture updates :-(

GLuint cached_single_texture_id;
void AcquireTangoImage(void *context, TangoCameraId id, const TangoImageBuffer *buffer)
{
    TangoData* td = (TangoData*)context;


}
void TangoData::ConnectTexture(GLuint texture_id) {
    cached_single_texture_id = texture_id;
  if (TangoService_connectTextureId(TANGO_CAMERA_COLOR, texture_id, nullptr,
                                    nullptr) == TANGO_SUCCESS) {
    LOGI("TangoService_connectTextureId(): Success!");
  } else {
    LOGE("TangoService_connectTextureId(): Failed!");
  }
  if (TangoService_connectOnFrameAvailable(TANGO_CAMERA_COLOR, this, AcquireTangoImage) == TANGO_SUCCESS) {
      LOGI("TangoService_connectOnFrameAvailable(): Success!");
  }
  else {
      LOGE("TangoService_connectOnFrameAvailable(): Failed!");
  }
}
Mark Mullin
  • 1,340
  • 1
  • 9
  • 21
  • 1
    On a related note, if you got the Hilbert release of the Tango core on 2/13 or thereabouts, seems the image format has changed from YUV to straight RGB - indicator is that stride == width – Mark Mullin Feb 14 '15 at 12:05