Displaying an image from a synchronized FrameGroup

Share source code samples for use with the Camera SDK
Post Reply
jmoody6
Posts: 3
Joined: Tue Jul 10, 2012 8:41 am

Displaying an image from a synchronized FrameGroup

Post by jmoody6 »

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.
beckdo
Posts: 520
Joined: Tue Jan 02, 2007 2:02 pm

Re: Displaying an image from a synchronized FrameGroup

Post by beckdo »

The FrameGroup is simply a list of synchronized frames. In your case it would contain two frames when the cameras are synchronized, which should always be the case so long as they are connected properly. If you need to figure out which frame is which, there are a number of ways. The easiest is when you get the frame, to look at it's camera's serial number. frame->GetCamera()->Serial();

The rasterize function is the way you get the camera imagery from the frame. It is designed to populate a frame buffer of your format, which is why you pass it a buffer and the specs like bits per pixel, width, height, etc. Alternatively, you can create a CameraLibrary::Bitmap and pass that in and it will get the information it needs.

Rasterize does not perform any sort of visual effects or image processing. It is just for getting the imagery out of the frame and in whatever format you specify.

In your case, if you want to composite two images together you should create a Bitmap for each camera. Use the frames coming from the framegroup to populate those Bitmaps. Then you'll also want to have a third bitmap. Then you can use Get/Put pixel on the bitmaps to perform the compositing yourself.
Shivasai
Posts: 1
Joined: Thu Oct 31, 2019 7:24 am

Re: Displaying an image from a synchronized FrameGroup

Post by Shivasai »

frameGroup->Count() is returning 1 even after adding 2 cameras in sync
Can anyone explain this problem.
Post Reply