<< return to Pixycam.com

Capturing frequency by USB port.

Hi,

I use libpixyusb library provided by Pixy to read image frames through USB port, request command is shown as following, however I find the sampling frequency is only 10~12 Hz, namely 10~12 frames/second, not 50Hz, Anyone knows why, and how to improve the fps?

return_value = pixy_command(“cam_getFrame”, // String id for remote procedure
0x01, 0x21, // 01:1280x800, 11:640x400, 21: 320x200
0x02, 0, // xoffset
0x02, 0, // yoffset
0x02, 320, // width
0x02, 200, // height (56 max @ 1280 w)
0, // separator
&response, // pointer to mem address for return value
&fourcc, //contrary to docs, the next 5 args are needed
&renderflags,
&width,
&height,
&numPixels,
&pixels, // pointer to mem address for returned frame
0);

Hello,
There are some limitations when grabbing frames like this. There is only 1 buffer to store a frame while it is transferred over USB. This usually means that the next frame is lost, limiting the maximum framerate to 25fps. But sometimes it takes more than a frame period to send an uncompressed frame over USB, which slows things down even more. Also, Pixy might be running its own image processing while you are grabbing frames. You should make sure Pixy is not running the default program by sending a stop command before grabbing a frame. Look for the “stop” command in this code:

http://cmucam.org/boards/9/topics/5106?r=6834#message-6834

Hope this helps!

Edward