Friday, July 10, 2009

OpenCV on Gumstix Overo

I managed to get OpenCV working properly on the Overo so for those that are interested here's how I did it.

After bitbaking the most recent build of omap3-destkop-image I downloaded the project files from here:

git clone git://github.com/pixhawk/pixhawk-oe.git pixhawk.collection

as listed on this page:

http://www.pixhawk.ethz.ch/wiki/tutorials/omap/openembedded_bitbake_installation


I used these files because they contain a convenient recipe for opencv which I know works. I had some trouble with the recipes included with OE but that might have been due to my limited understading of OE and bitbake.

The recipe requires libdc1394 and ffmpeg to be bitbaked first as well, and possibly some others I can't quite remember.

After the bitbake finished, I installed the libdc1394, ffmpeg, and OpenCV packages on the Gumstix. These packages also depend on others, if you have a net connection they'll download automatically, otherwise you may need to bitbake them in your build environment and install them manually.

Since I've decided to do native compiling on the Overo I also installed the GCC and G++ compilers and libraries, as well as pkgconfig. This allows me to simply compile my programs on the Overo without having to worry about cross compiling.

Finally here's a video of my simple hough-circle detector. I used a Logitech Quickcam Pro 9000. As you can see frame rate is really low, around 1fps. Even after removing the code for object detection, leaving only the video streaming and display I was only able to improve this marginally. I'm not sure how this compares to the Overo Water, so if anyone has any experience please let me know.


12 comments:

  1. Hi Rod,

    Nice work,

    How did you install gcc and G++ compilers on board for native compilation.I have OE setup on my linux machine.
    Could you please tell me

    Sri
    srikanthparupati@gmail.com

    ReplyDelete
  2. Hi Sri,

    I did the following:

    For the C build environment:

    opkg install gcc
    opkg install gcc-symlinks
    opkg install libc6-dev
    opkg install binutils
    opkg install make

    And for C++:

    opkg install g++
    opkg install g++-symlinks
    opkg install libstdc++-dev
    opkg install libstdc++6

    Finally, because I'm using the OpenCV compilation instructions from here:

    http://opencv.willowgarage.com/wiki/CompileOpenCVUsingLinux

    I also did:

    opkg install pkgconfig

    I can't remeber if these packages had other dependencies but since I have a net connection on my Gumstix they just downloaded automatically.

    If you're bitbaking the packages on your machine you'll need to:

    bitbake make pkgconfig

    I'm pretty sure the others are created when you bitbake one of the console or desktop images.

    Finally, find the packages in the

    /tmp/deploy/glibc/ipk/armv7a

    and copy them over and install.

    Hope that helps.

    Rod

    ReplyDelete
  3. Thanks Rod,

    I am curious to know How did you run face detection application on video from the camera.

    I have run face detection application on Image but unable to run on the video from camera.

    How should I specify the camera index for the below instruction

    facedetect --cascade="haarcascade_frontalface_alt.xml" ..cameraindex????.........

    ReplyDelete
  4. Hi,

    I've never run the face detection application so I can't answer your question unfortunately.

    Maybe someone else can help here?

    Rod

    ReplyDelete
  5. Hi,

    I was able to bitbake opencv with the recipe from the pixhawk.collection as you pointed out and got opencv-apps, opencv-dbg, opencv-dev and opencv-doc, but no opencv-bin as required in some of the image recipes. So I transferred those opencv*.ipkgs to my overo and opkg installed them. Problem is pkg-config --libs opencv does not show a path to the libraries and neither can I locate the libraries physically.

    How did you do it?
    Were you using opencv-git.bb?
    Did you get a opencv-bin.ipk?

    I'm very new to Linux, Overo, bitbake and Opkg. Sorry.

    Thanks.
    c2

    ReplyDelete
  6. Hi Ron,

    Great tut, really helped me.

    Have you ever seen a error while installing libdc1394?, ive been getting missing checksum errors?

    Adam M.

    ReplyDelete
  7. Sorry about the late reply, I've been busy with uni stuff.

    Adam, I did get missing checksum errors so I disabled the checksum checking. You can do this by setting OE_ALLOW_INSECURE_DOWNLOADS="1" in your conf file.

    Anonymous, not sure about your problem. I'm in the process of rebuilding my environment so I don't have an answer for you at the moment.

    ReplyDelete
  8. Hi Rod

    How do I install libdc1394 on an Overo

    Cheers

    Rahul

    ReplyDelete
  9. Hi Rahul,

    A bit late I know but I've been a little busy. The git pull mentioned above:

    git clone git://github.com/pixhawk/pixhawk-oe.git pixhawk.collection

    includes a working recipe for libdc1394. Bitbake this recipe and then install the ipk package onto the gumstix. I hope this helps.

    Rod

    ReplyDelete
  10. Thanks Rod, I have this recipe working. I am looking to stream some low fps video to a PC over wi-fi to do some image processing. How do you get ffmpeg to work with opencv using this recipe

    Cheers

    Rahul

    ReplyDelete
  11. Hi Rahul,

    Sorry I'm not sure about ffmpeg. Not sure if I ever got it working. Good luck with it, I'm finished with my thesis so I don't have access to the Gumstix anymore.

    Rod

    ReplyDelete
  12. ffmpeg is part of the pixhawk build. Has anyone been able to access a USB camera via the pixhawk opencv build?

    thanks
    Azhar

    ReplyDelete