multiple camera object mode data c++

Post Reply
antithing
Posts: 5
Joined: Fri Mar 27, 2015 6:56 am

multiple camera object mode data c++

Post by antithing » Mon May 18, 2015 3:24 am

Hi all, I have 2 Flex13s that I am trying to access in c++, into open CV.

Using:
Camera *camera = CameraManager::X().GetCamera();

I get camera ID 1 fine. How should I go about getting both at the same time, or switching between the 2?

Thanks!

antithing
Posts: 5
Joined: Fri Mar 27, 2015 6:56 am

Re: multiple camera object mode data c++

Post by antithing » Mon May 18, 2015 10:03 am

UPDATE. Using getCameraBySerial I have solved the first issue. Now I need to get the XY data of each point.

I have:

for (int i = 0; i < frameLeft->ObjectCount(); i++)
{
printf("objects: %d \n", frameLeft->Object(i));
}

which gives something, but I am not sure what... What is the command to get the X and Y coordinates?

thanks!

steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 576
Joined: Mon Jan 19, 2015 11:52 am

Re: multiple camera object mode data c++

Post by steven.andrews » Mon May 18, 2015 11:02 am

Hi antithing,

I'm happy to hear you're making progress. I think that retrieving the 2D information takes a couple of steps as there's some accounting for lens distortion. If you take a look at the VectorTracking sample that installs with the SDK, this should show you the process for receiving that information.

I hope this sample helps with your question. If you need further assistance, please feel free to reach out to us.

Cheers,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer

antithing
Posts: 5
Joined: Fri Mar 27, 2015 6:56 am

Re: multiple camera object mode data c++

Post by antithing » Tue May 19, 2015 3:52 am

Thanks Steven, that looks straightforward. I am still having problems streaming two cameras at once...

If I use Camera *cameraRight = CameraManager::X().GetCameraBySerial(xxxxxx);

I can access the images and switch between cameras by changing the serial.

When I try to stream both at once like this (either by duplicating the function, or passing both cameras in the same function) though, it works for a while, then freezes up.

I have tried using the Camera list, as shown in the FrameSync sample:


CameraLibrary::CameraManager::X();

PopWaitingDialog();

//== Verify all cameras are initialized ==--

if (CameraManager::X().AreCamerasInitialized())
printf("complete\n\n");
else
{
printf("failed (return key to exit)");
getchar();

}

//== Connect to all connected cameras ==----

Camera *camera[kMaxCameras];
int cameraCount = 0;

CameraList list;

printf("Cameras:\n");

for (int i = 0; i<list.Count(); i++)
{
printf("Camera %d >> %s\n", i, list.Name());

camera = CameraManager::X().GetCamera(list.UID());


if (camera == 0)
{
printf("unable to connected to camera...\n");
}
else
{
cameraCount++;
}
}

if (cameraCount == 0)
{
printf("no cameras (return key to exit)");
getchar();

}


In the sample project, it works great, but as soon as I put it in a different project, it can't find the cameras. No errors, the code is exactly the same, the properties are the same, but it prints 'no cameras'.

When debugging, it shows that list.Count stays at 0. Is there a way to manually add the two cameras to the list using getCameraBySerial?
Or a way to stream multiple feeds without using a list?

thanks again.

Post Reply