0

I copy the YV12 frame in the callback passed to TangoService_connectOnFrameAvailable() via:

uint8_t* dest_buffer = destination_tango_image->data;
int src_offset = buffer->stride;
int dest_offset = 0;
// copy Y channel
static const int height = buffer->height;
static const int width = buffer->width;
static const int stride = buffer->stride;
for(int i = 0; i < height; i++) {
  memcpy(dest_buffer + dest_offset, buffer->data + src_offset, width);
  src_offset += stride;
  dest_offset += width;
}
// copy V channel
static const int half_width = width / 2;
static const int half_height = height / 2;
static const int half_stride = stride / 2;
for(int i = 0; i < half_height; i++) {
  memcpy(dest_buffer + dest_offset, buffer->data + src_offset, half_width);
  src_offset += half_stride;
  dest_offset += half_width;
}
// copy U channel
for(int i = 0; i < half_height; i++) {
  memcpy(dest_buffer + dest_offset, buffer->data + src_offset, half_width);
  src_offset += half_stride;
  dest_offset += half_width;
}

After doing this, I've tried displaying the YV12 image in vooya and also (following a previous answer here) displaying it after converting to RGBA. However, in both instances I see some artifacts in the top left and entire bottom of the image. Here is an example:

image artifacts

Is there a problem with how I'm copying the data? Or is this a problem with TangoService_connectOnFrameAvailable()? Or a problem with the tablet's camera?

Community
  • 1
  • 1
t2k32316
  • 993
  • 1
  • 13
  • 29

1 Answers1

0

You did nothing wrong on parsing the image, the artifacts you see here is actually the meta data stored in the image, which is used in the lower stack in the Tango Service.

xuguo
  • 1,816
  • 1
  • 11
  • 15
  • The API docs state that the first scan line has the meta data, but I already skipped the first scan line by initially setting src_offset = buffer->stride. So there's still more meta data in the 1280x720 image that I need to get rid of? If so, how is that done? – t2k32316 Feb 09 '15 at 23:44