OptiTrack SDK and openCV

Post Reply
alexandre_fs
Posts: 8
Joined: Mon Feb 25, 2008 11:22 am

OptiTrack SDK and openCV

Post by alexandre_fs »

Hello. I have two Flex C:120 cameras and i'm developping a computer vision aplication for them.

I have already the application written using the openCV library (i was using 2 normal webcams...), but the problem is that these cameras are not recognized as such, so the openCV can't open these devices.

So, what i tried to do next, was to capture the camera frames using the optiTrack API and then convert the frames to objects that openCV would recognize. I am having a lot of dificulties doing this so i was wondering if anyone has any experience in using the openCV library with Optitrack cameras and could share some information.

Thank you for your attention
Alexandre
mehwish
Posts: 5
Joined: Sat May 31, 2008 10:14 am

Re: OptiTrack SDK and openCV

Post by mehwish »

I want design strategies for the 3D human motion capture.
Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: OptiTrack SDK and openCV

Post by Birch »

Can you share more information with us about the issues you are having with the camera images? Are you able to read the images and are just having trouble packing them for openCV consumption? Or are there problems reading data from the cameras?
Jim
Posts: 1395
Joined: Mon Oct 14, 2002 5:00 am
Location: Corvallis, Oregon
Contact:

Re: OptiTrack SDK and openCV

Post by Jim »

It sounds like you need our DirectShow filter, that will give you easy access to the grayscale images. It is avalible from our Support/downloads section. Check for C120 compatibility, but I am pretty sure it is supported.
alexandre_fs
Posts: 8
Joined: Mon Feb 25, 2008 11:22 am

Re: OptiTrack SDK and openCV

Post by alexandre_fs »

Thank you for your answer.

I am able to read the images. I'm using the grayscale C++ sample that you provide and it works perfectly. The only problem I am having is to use the captured image frame buffer in openCV. I'm posting here the code that I have.

// openCV frame
IplImage* cvFrame = cvCreateImage(cvSize(355,290),IPL_DEPTH_8U,1);

unsigned char *data = (unsigned char *)(cvFrame->imageData);

static unsigned char frameBuffer[355*290];

// Get the frame from camera (using OptiTrack API)
camera->GetFrameImage(frame, 355, 290, 355, 8, (byte *) frameBuffer);

// Convert OptiTrack Frame object to OpenCV Frame object
for (int i=0; i<355*290;i++)
{
data = frameBuffer;
}

// Update openCV HighGUI Window
cvShowImage("openCVWin",cvFrame);


What i get with this is almost what i want. But the image in openCV window is split in half and a bit distorted. I tried all types of image depth in IplImage...

I understand that this subject is not the scope of this forum, so I thank you for your inputs.
alexandre_fs
Posts: 8
Joined: Mon Feb 25, 2008 11:22 am

Re: OptiTrack SDK and openCV

Post by alexandre_fs »

I will definitly take a look to your DirectShow filter. There are some examples of openCV and DirectShow, so maybe using that filter that you describe I can pack the data to use with openCV.
alexandre_fs
Posts: 8
Joined: Mon Feb 25, 2008 11:22 am

Re: OptiTrack SDK and openCV

Post by alexandre_fs »

For anyone who might be interested, i found why the image is distorted...

to convert to an openCV frame buffer, the ByteSpan parameter in GetFrameImage method must be width+1 (for 8 bit depth images)

camera->GetFrameImage(frame, 355, 290, 356, 8, (byte *) frameBuffer);
ntvy
Posts: 1
Joined: Sun Aug 03, 2008 7:11 pm

Re: OptiTrack SDK and openCV

Post by ntvy »

I have simple code :

curFrame = cvCreateImage(cvSize(355, 290), IPL_DEPTH_8U, 1);

camera->GetFrameImage(frame,curFrame->width,curFrame->height,
curFrame->widthStep, 24,
(byte *)curFrame->imageData);
sebwouaib
Posts: 1
Joined: Thu Sep 05, 2013 12:37 am

Re: OptiTrack SDK and openCV

Post by sebwouaib »

Hi,
Quite old discussion but you have still your development files about doing tracking with Flex C120 and OpenCV, it would be helpfull.
Regards,
Sébastien CHEVRIAU (UTBM)
Post Reply