Displaying an image from a synchronized FrameGroup
Posted: Thu Jul 12, 2012 6:11 am
I am working with a set of two V120: SLIM optitrack cameras. I am trying to get one synchronized image from the two cameras, and am having trouble. My code is an amalgamation of the ImageProcessing example and the FrameSynchronization examples included with the SDK download. So I created a syncModule then a FrameGroup and try to raster the image from the FrameGroup->GetFrame() and display it in a window. However, the program compiles, but does not give me one composite image, but instead flickers back and forth between the images from the two cameras. The documentation does not make it clear exactly how the Rasterize function works or how the 2 frames from the synchronized cameras are stored within the FrameGroup. Any clarification/information would be greatly appreciated.
Here is the part of the code that calls the frame and sends it to the window:
//== Pool for frame groups ==--
while(!_kbhit())
{
FrameGroup *frameGroup = sync->GetFrameGroup();
if(frameGroup)
{
static int frameCount = 0;
frameCount++;
for(int i=0; iCount(); i++)
{
Frame * frame = frameGroup->GetFrame(i); // Get a frame.
if(frame)
{
//== Have the Camera Library raster the camera's image
//== into the texture.
frame->Rasterize(framebuffer);
//== Display Camera Image ============--
if(!DrawGLScene(&Texture))
break;
//== Escape key to exit application ==--
if (keys[VK_ESCAPE])
break;
}
//== Release frame =========--
frame->Release();
}
printf("\n");
}
frameGroup->Release();
//== Service Windows Message System ==--
if(!PumpMessages())
break;
}
Thank you.
Here is the part of the code that calls the frame and sends it to the window:
//== Pool for frame groups ==--
while(!_kbhit())
{
FrameGroup *frameGroup = sync->GetFrameGroup();
if(frameGroup)
{
static int frameCount = 0;
frameCount++;
for(int i=0; iCount(); i++)
{
Frame * frame = frameGroup->GetFrame(i); // Get a frame.
if(frame)
{
//== Have the Camera Library raster the camera's image
//== into the texture.
frame->Rasterize(framebuffer);
//== Display Camera Image ============--
if(!DrawGLScene(&Texture))
break;
//== Escape key to exit application ==--
if (keys[VK_ESCAPE])
break;
}
//== Release frame =========--
frame->Release();
}
printf("\n");
}
frameGroup->Release();
//== Service Windows Message System ==--
if(!PumpMessages())
break;
}
Thank you.