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
OptiTrack SDK and openCV
Re: OptiTrack SDK and openCV
I want design strategies for the 3D human motion capture.
Re: OptiTrack SDK and openCV
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?
Re: OptiTrack SDK and openCV
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.
-
- Posts: 8
- Joined: Mon Feb 25, 2008 11:22 am
Re: OptiTrack SDK and openCV
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.
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.
-
- Posts: 8
- Joined: Mon Feb 25, 2008 11:22 am
Re: OptiTrack SDK and openCV
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.
-
- Posts: 8
- Joined: Mon Feb 25, 2008 11:22 am
Re: OptiTrack SDK and openCV
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);
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);
Re: OptiTrack SDK and openCV
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);
curFrame = cvCreateImage(cvSize(355, 290), IPL_DEPTH_8U, 1);
camera->GetFrameImage(frame,curFrame->width,curFrame->height,
curFrame->widthStep, 24,
(byte *)curFrame->imageData);
Re: OptiTrack SDK and openCV
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)
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)