<< return to Pixycam.com

Pixy Linux V4L Device

Hello, and good afternoon!

I want to know some information in how does Pixy work with Linux. I want to stream it to ROS as a V4L device, is this do-able? How does the PixyMon software manage this on Linux? It’s a proprietary raw image gathering from USB?

Thank you in advance!

Pedro

Hello Pedro,
Pixy doesn’t use V4L in Linux. It uses a simple custom protocol ontop of libusb. Libpixyusb is a straightforward library for interacting with Pixy and grabbing images over USB:

http://cmucam.org/projects/cmucam5/wiki/Building_the_libpixyusb_example_on_Linux

Here’s some example code on how to grab a raw image using libpixyusb:

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

Hope this helps!

Edward

Hello Edward!

It helped! But now I am asking myself if there is any interface for C++ instead of C, or even Python. I guess not, right?

Pedro

Edit: Also, I would like to know what resolution I can take from the camera interface, through USB. As I’ve seen, most of the detection gives back coordinates in a 320x200 space, and I would like to have them in a 640x400 space. Is this do-able?

Hello Pedro,
libpixyusb is compatible with C++. Here’s some info on Python:

http://cmucam.org/projects/cmucam5/wiki/Building_libpixyusb_as_a_Python_module_on_Linux

Regarding resolution, grabbing raw camera frames is limited to 320x200 because Pixy doesn’t have enough free RAM to store a larger frame. Sorry… :frowning:

Can you describe your application? Pixy can be used as a frame-grabber, but Pixy works best when the image processing is handled onboard Pixy.

Edward

My application is to use a Pixy to get positions from 4 IR LED’S which are 30cm apart from one-another and mounted on a UAV which can be at up to 5m/4m from the camera. Do you think it will work on these conditions?

Thank you in advance!

Pedro

Hi Pedro,
Your application sounds very similar to what the IR-lock folks are doing

You might check out what they’re doing and how they are getting positions of IR sources.

Edward

I have asked them if it can detect 4 LED’s 30cm apart from each-other and at 5m (3m would be do-able) distance from the sensor, but the main problem is if it can distinguish them nicely. Perhaps you could give me some hint on this?

Thank you in advance Edward!

Pedro

Hello Pedro,
By distinguish them, do you mean detect them? Or do you mean telling LED 1 from LED 2? Detection is solved very robustly by the IR-lock folks. Telling the difference between LED 1 and LED 2 is a more complicated problem though. I’m not sure what the best approach would be for solving this.

Edward

I mean detect them. I need, on the output, something like “there is one LED at x and y, there is another LED at x2,y2, …”, but the thing is, with low resolution, at a certain distance (5m is my objective), does it detect the 4 LED’s considering they are 30cm apart from each-other in the body frame?

Hello Pedro,

does it detect the 4 LED’s considering they are 30cm apart from each-other in the body frame?

At 5M, it seems reasonable. You can calculate, assuming a 70 degree horizontal field-of-view.

2*tan(FOV/2)*d = Width

2*tan(70/2)*5m = 7m

7m/640 = 11cm per pixel

If you go with the IR-lock lens and algorithm, the field-of-view will be different. It will probably be narrower. For your application, you might consider using a longer focal length lens since your objects are so far away.

Edward