camera driver stops delivering frames in greyscale mode

Post Reply
symfonysid
Posts: 20
Joined: Fri Nov 09, 2007 7:39 am

camera driver stops delivering frames in greyscale mode

Post by symfonysid »

Hi,

I've been working on an unusual application using an Optitrack camera. The application uses the camera to track the motion of fingers on a surface using its blob tracking, but every 100 frames the application switches the camera into greyscale mode to get a greyscale image that it can use to track the movements of objects on the surface. Unfortunately, though the camera driver "freezes" sometimes after being switched into greyscale mode. Sometimes it takes only a few minutes. Other times it takes longer. But the camera's driver invariably stops delivering image frames after some period of time.

I have no idea why this is but every time I get a greyscale image from the camera I see the following message in VisualStudio "Bad footer CRC on incoming data". Maybe this is related to the problem?

I'm using the latest Optitrack SDK (version 1.3.035), and the application is written in C++ and is receiving frames via a callback.

Any help with this problem would be appreciated.

Thanks!
Greg
Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: camera driver stops delivering frames in greyscale mode

Post by Birch »

(I'm guessing you are using a V100 camera?)

It sounds like there isn't enough bandwidth on the USB port you are using to get a full grayscale image across uncorrupted. With a V100, full frame rate grayscale (640 x 480 @ 100fps) comes out to about 30 MB a second, which is close to the real-world maximum throughput for USB 2.0. Some systems can do this at the full rate, others require some tweaking to get grayscale data through.


There are a couple things you can do to improve the amount of USB throughput allocated to the camera :

1) Make sure the camera is on its own EHCI, most modern computers have at least two. Any other USB devices on the same EHCI will reduce the amount of bandwidth available to the camera.

2) Try directly connecting the camera to the PC if you are using a hub right now


Here are things you can do to reduce the camera grayscale data rate, these will increase the chances of transmitting an entire grayscale image without any lost data. You can set these right before enabling grayscale mode, then turn them back off for the pre-processed image modes :

1) Try setting the frame decimation to only send every other, or every fourth frame. This allows the camera to continue running at full rate, but provides a little extra time to get a frames image out.

2) You can also reduce the size of the grayscale frame by setting the spatial decimation to generate a 1/2 scale (320 x 240) or 1/4 scale (160 x 120) grayscale image

3) If your application is asking the OptiTrack SDK to render the frame data, avoid rendering every frame (try every 2 or 4 perhaps). Rendering each frame can slow down servicing the incoming frame data, which might result in dropped frame.

4) Lastly, and not as desirable, you could reduce the frame rate of the camera from 100 fps down to 50 fps or 25 fps. This is should be a last resort after the previous suggestions since it will alter the exposure timing (allow 2x or 4x as much light in) as well as increase the amount of image blurring from motion.


Please also see the following FAQ entry :
http://www.naturalpoint.com/optitrack/s ... .html#q204


*) You could also try using selective grayscale mode. It will only transmit grayscale data for the regions where bright objects have been detected, instead of the entire frame. As long as the number of bright regions are small, it will be more efficient than transferring the full frame.

Note : there may be occasional small artifacts when rendering selective grayscale frames.

Code: Select all

CComVariant var;

  // tell OptiTrack SDK to render selective grayscale with
  // pixel brightness values
  var = (int)(NP_TEXT_OVERLAY_PRECISION_GRAYSCALE);
  m_spCamera->SetOption(NP_OPTION_TEXT_OVERLAY_OPTION, var);

  // enable selective grayscale mode
  var = (int)4;
  m_spCamera->SetOption(NP_OPTION_VIDEO_TYPE, var);
symfonysid
Posts: 20
Joined: Fri Nov 09, 2007 7:39 am

Re: camera driver stops delivering frames in greyscale mode

Post by symfonysid »

Hi Birch,

Thank you for your detailed response! I appreciate it.

Unfortunately, I think your basic premise that it's a through put problem is wrong. I'm only taking one greyscale image every second. I take 100 blob images, switch into greyscale mode to take 1 greyscale image, and then switch back into blob tracking mode to take another 100 blob images. And what's more I set the camera down to 25 frames / sec before switching into greyscale mode.

Nonetheless, I tried some of the things you suggested. I tried decimating the images to only send every other image, but that didn't help. I can't reduce the image size, b/c we need a 640 * 480 image for the object tracking algorithm to work properly. I'm not using the Optitrack SDK to render the images but rather OpenGL. So, I didn't make any changes there. And I tried using selective greyscale mode, but the image it delivered couldn't be used for the object tracking algorithm. So, I gave up on that. I would have tried using the MJPEG image compression, but I don't think my camera supports that.

Hm. If it would be helpful, I could send you a link to a URL where you could download the application and its source. This problem is a bit odd, and maybe, it would help if you could see it yourself.

Greg
Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: camera driver stops delivering frames in greyscale mode

Post by Birch »

Sure, send an email to support @ naturalpoint.com with a link and we can take a look.
Post Reply