Page 1 of 1

Displaying an image from a synchronized FrameGroup

Posted: Thu Jul 12, 2012 6:11 am
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 ==--
FrameGroup *frameGroup = sync->GetFrameGroup();

static int frameCount = 0;

for(int i=0; iCount(); i++)
Frame * frame = frameGroup->GetFrame(i); // Get a frame.

//== Have the Camera Library raster the camera's image
//== into the texture.

//== Display Camera Image ============--

//== Escape key to exit application ==--
if (keys[VK_ESCAPE])
//== Release frame =========--

//== Service Windows Message System ==--

Thank you.

Re: Displaying an image from a synchronized FrameGroup

Posted: Thu Jul 12, 2012 12:48 pm
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.

Re: Displaying an image from a synchronized FrameGroup

Posted: Thu Oct 31, 2019 8:36 am
by Shivasai
frameGroup->Count() is returning 1 even after adding 2 cameras in sync
Can anyone explain this problem.