Using OpenCV with the Raspberry Pi

opencv

When we first heard of the Raspberry Pi we were elated that projects that once required a full-blown computer could now be done on a tiny, and cheap board running Linux. Unfortunately, we haven’t seen much in the way of using computer vision algorithms on the Raspi, but thanks to [Lentin] the world of OpenCV is now accessable to Raspberry Pi users everywhere.

[Lentin] didn’t feel like installing OpenCV from its source, a process that takes the better part of a day. Instead, he installed it using the synaptic package manager. After connecting a webcam, [Lentin] ssh’d into his Raspi and installed a face detection example script that comes with OpenCV.

It should be noted that [Lentin]‘s install of OpenCV isn’t exactly fast, but for a lot of projects being able to update a face tracker five times a second is more than enough. Once the Raspberry Pi camera module is released the speed of face detection on a Raspi should increase dramatically, though, leading to even more useful computer vision builds with the Raspberry Pi.

Comments

  1. Tobi says:

    and how exactly is this a kind of a hack ? this is by no means worth an article on hackaday !! everyone that is able to google and has ever used linux is able to do this ?!

    • static says:

      Sorry I had LOL when I read this comment. Following this logic; every and all hacks featured here could be deemed not a hack because the hack could be duplicated by anyone with the ability to use the same tools and/or products used to do the featured hack.

      • Tobi says:

        as many other commenters pointed out (maybe a little more elegant than me), using a package manager, and installing and using a program is not even near the stuff I (and I am sure a lot of others) would like to read on hackaday. How would you like it if I posted about using gedit/office/mplayer/younameit on the PI ? “yeah, I even installed it all by myself using apt!”. the “logic” you are trying to put in my comment is just intentionally misinterpreted. There is nothing clever or hacked or remotely exciting in this article. He downloads and uses a program the way it is intended to, and thats it.

        • Eirinn says:

          There sure is if you’re not into linux, but have a RasPi and looking for those to do with it.

        • Dave says:

          Tobi>> I disagree.
          Although it may not be a true hack, it is still information that some may find useful.
          I quite like articles like this, as it presents new options as to what to use the PI for, possibly spawning new ideas in creative minds reading HaD.

          • Tobi says:

            if it needs articles like this to spawn ideas … you should probably take a look at dALE’s toilet-tutorial that is coming out soon. You will find that most probably very interesting!

    • IJ Dee-Vo says:

      Hack A Day.
      A hack a day.
      Not
      Only hacks.
      If you get one hack a day
      It meets its promise

  2. Jan says:

    The problem on RasPi isn’t the camera but the general lack of performance and memory. The camera module will not help at all with that, I am sure that the webcam is not a bottleneck but that the RasPi is simply unable to process the video at faster rate.

    OpenCV is a very computing intensive library due to the nature of the computer vision algorithms used. I am actually amazed that the poster even managed to get something semi-usable from it on RasPi.

  3. Zee says:

    It would run a lot faster if we were allowed access to the GPU. In fact I don’t even want the gpu to be opened. I just want GPU accelerated opencv and opencl support for the rpi

  4. Jim says:

    Whaaaa…?? So he installed synaptic using apt-get, then installed a VNC viewer using apt-get, so that he could install opencv using synaptic. Pro tip: “apt-get install opencv” and get on with your life.

    • Jakob says:

      And a disgrace it took 3 comments until this was pointed out.

      • EccentricElectron says:

        Funnier still – the veiled subtext that somehow *building from source* would have made it even more of a leet hack. If he’d done something – anything – that involved a line of code, it might have qualified as a hack, but c’mon – he didn’t even tweak the supplied sample!

        • lentinlabs says:

          Hi EccentricElectron
          I builded opencv from the source code in Rpi and it took 6-7 hours. After that i installed synaptic and saw this opencv libs in synaptic.

          This post will be a useful tip, who wanted to work with opencv without building source code. Its not at all a great hack and what i did in the code is just the frame scaling.

          • EccentricElectron says:

            Hi Lentin – I am sorry, I in no-way meant to diss you and your efforts – it is just the editorial thing I am being critical of. Perhaps hackaday needs to include articles like these in a different section – sure, it can form the basis of future hacks & it’s useful to know that it’s possible/how to get it done, but it is not a hack per-se. If you are regularly building sources for the RPi you might want to look at a cross-compiler, rather than doing it on board. They can be painful to set up, but will pay dividends in the long term.

      • Bob Fleming says:

        Also, why is this even news?
        I would understand if he compiled it himself and made it available to others or something, but if it’s available in the standard Debian/Ubuntu repository then where is the inventive/creative/newsworthy step?

    • Lentin says:

      Yea , we can do like that , Just took synaptic to show the opencv packages

    • lentinlabs says:

      Yea ,correct ,i just took synaptic to show the various opencv packages.

  5. Doktor Jeep says:

    Good stuff. Time to finally get one of these boards (for me).

  6. atiti says:

    Heh ye, it’s somewhat annoying that some of the cooler stuff (like my retro “hack”) does not get in, and guys that can install a package from the official debian repository does…

    I guess everything that has raspberry pi in it is newsworthy. Oh well..

  7. David Gillooly says:

    Things can be obvious to one group and yet be a mystery to another.
    Chill out.

  8. Ya, I’m going to have to agree, this is a new low. Hackaday, I installed Fail2ban today via apt-get, can I email you details and have a post?

  9. Peter Brickles says:

    Along the same lines as the web scraping post a month or two back.

    Nothing new to see move along please

  10. Erik says:

    Hackaday content falls into a couple of categories – the ones that ought to receive the Nobel Prize for Hacking, and “putting a blinking LED on a ____”. I gave up on Make’s blog because it was all the latter, but I suspect if you restricted yourself to utterly epic hacks then you’d have one article a week. Or maybe you’d have “Home Shop Machinist”, I don’t know.

    Point being – there’s room in the world for both kinds of articles, and if you don’t like it then Caleb will refund your full purchase price. And maybe those blinky LED projects will serve as a gateway drug?

    QEX, for instance, has a mixture of commercial-grade hacks interspersed with a bunch of WTF. It still sells subscriptions. Circuit Cellar is pretty similar in that regard.

    • Thank you.

      On the plus side, these comments have given me the idea of a ‘this is a new low’ alarm. Scrape all new comments on HaD for the phrase, ‘a new low’ and hook it up to an alarm. Or bell. Or something.

      I’ll have to dig around the wordpress docs this week and get a build up. I’ll probably have to post a, ‘blink a LED with an Arduino’ post afterwards, though.

      • Locke says:

        The problem I have with Hackaday is the hype that’s created all the time. It’s worse than a paid marketing team. For instance: “…thanks to [Lentin] the world of OpenCV is now accessable to Raspberry Pi users everywhere.” Yet, in the very next paragraph, you state: “[Lentin] didn’t feel like installing OpenCV from its source, a process that takes the better part of a day.” But, whatever, I guess. I’m not telling you what to do, this is just something I’ve seen in a lot of articles lately.

  11. spider says:

    and in other news someone has managed to install php through synaptic…

  12. I once made my own version of hackaday with PHP where I used some scraping library to get all the posts and images, and then used some regexes to filter out Arduinos and other stuff related to blinking LED’s etc.
    The results were surprisingly few articles!
    (Mind that this was before the days of the Raspberry Pi. Oh and I sent it in as a hack just for the fun of it, I think it was Caleb who responded and he got a little mad for “trying to steal readers” hehe..)

  13. Kevin Keith says:

    sudo apt-get install opencv

    Look mom! I’m a l33t h4xx0r now!
    I know it’s cliche, but looking back at stuff that was posted here even a year ago, it is clear that the quality of this site has dropped precipitously. I’d take arduino-spam over this. This is a new low in Raspberry Pi pandering.

  14. spider says:

    im starting to think HaD gets payed everytime the mention a rasberry pi

  15. J says:

    Here another funny one. Someone who “developed” Airplay for the Raspberry PI. What het did was install shairplay……

    http://tweakers.net/nieuws/86332/hobbyist-maakt-airplay-speaker-van-raspberry-pi.html

  16. wondering@home.com says:

    Look at all of the creative, outside-the-box-thinking “hackers” spewing the same comment over and over again! You silly bastards, just go and read somewhere else.
    (I thought HAD, a few months ago, discussed changes to the comments that would help eliminate some of this nonsense…)

    • Doktor Jeep says:

      There’s way too much snarkery here. Look guys, I’m just glad to see that OpenCV can run on this little system. Didn’t know it beforehand. Ever write a program or install something that didn’t go right? When things come off the rails, you end up “trying everything” so it becomes a hack anyway. Who cares if this meets some criteria for a hack or not. It’s a little blurb you can keep in your brain so that when a problem comes up later, you know “ah, I saw once where someone did this”.

      Frankly all this energy that goes into being critical on the internet, all this “nerd rage” is shameful.

    • wondering@home.com says:

      P.S. Sorry for the harshness. But please, how about some encouragement?
      Thank you all.

  17. Robot says:

    I came here for the hate.

  18. ze man says:

    HaD aka H8aDay

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,679 other followers