Pablo Aizpiri

My experiences and thoughts on [mostly] technology.

.NET PixyCam Library

Not too long ago I saw a Charmed Lab’s PixyCam project on Kickstarter, and I decided to contribute.

PixyCam

My PixyCam assembled with Pan/Tilt Mechanism

I was really excited about all the possibilities vision can bring to the maker community. I later received the camera, and I have to admit it’s pretty cool. The PixyCam is basically a camera with a micro controller that can be used to tag and recognize colored objects. It can then send this “digested” data back to a micro controller that normally wouldn’t have the processing power to do object recognition. For example, certain colors can be tagged- “signatures”- and the camera can send back through an I2C connection the coordinates and size of one or more rectangles matching this “signature”. And at 50 FPS, there’s some pretty nifty stuff you could do with it, like a robot that follows a ball.

The camera also has two ports to connect two servos that you can control through the I2C connection as well. This makes it easy to quickly get up and going. After assembling mine with a pan/tilt mechanism, I played around with the standard demo program and had fun seeing it “look around” at whatever I had tagged for it to view. Next, I wanted to use it to try out some other ideas, but I wasn’t ready to use it with a micro controller and work on all the programming that goes along with that. Instead, I wanted to quickly use .NET to play around with it. Much to my dismay, I could not find an easy way to do this. Ironically, my desire for an “easy” route led me to build a .NET library. I wanted one and figured others could use it as well.

I’m still working on it but I put together a Visual Studio solution that includes my C# .NET PixyCam library, and the required C++/C projects (only required to generate the DLLs the .NET library uses).

I also included a sample .NET application that uses the library so that it can be easy to get started. The solution and source code can be found on GitHub: https://github.com/JhottMaster/PixyUSBdotNET/tree/master

A couple notes:

1.) Make sure you set a signature if you want the sample application to work. Just fire up PixyMon and tag a color to use as a signature.

2.) Make sure you are using a cable that works (most recommended is under 3 feet) or sends enough power to the servos. I deal with this a lot and it was super frustrating, until I got a cable that could transmit more power over further distances.

3.) The library is a work in progress, keep that in mind. Read the README file for more info.

 

 

4 Comments

  1. Hi Pablo,
    I’m interested in this too. Did you get it going ?
    I’ll need the code in c or c++, but I could do that if it works.
    Wonder why nobody did this before ?
    Best,
    jan

    • Pablo

      December 27, 2016 at 6:39 pm

      Hey Jan,

      Sorry I took so long to reply. The pixy team already has this code in C/C++; in fact, it’s what I used to piece together my .NET version, although I wasn’t able to go back to working on it.

  2. Hi Pablo,
    Thanks for the post and for sharing your c# .net solution for Pixy camera. I have got some questions for you and I would appreciate you if you can advice me on them.
    I am looking for a good camera to embed in my robot’s eye to do some vision (image processing) with that. I need to recognize a few colored objects with and get the pixel address of them and keep track of the items in a room. Please can you tell me how Pixy is efficient in that? what is the detection range (in meter) that it is able to recognize colors? what is its FOV angles?
    Do you think if it is a right option to be integrated in a humanoid robot? or do you have any other suggestion for me?

    In future I will need to do face tracking… does it provide a Bitmap of the image frame to allow me to apply Opencv of for example Aforge?

    Currently I am developing my system under C .Net framework visual studio 2013.
    Thanks in advance.
    Parsa

    • Pablo

      December 27, 2016 at 6:38 pm

      Parsa,

      Pixy isn’t going to be good fit for advanced robot vision. It’s good for simple on board processing in detecting certain hues. I would use a regular webcam for your project.

      Good Luck!
      Pablo

Leave a Reply

Your email address will not be published.

*

© 2017 Pablo Aizpiri

Theme by Anders NorenUp ↑