Using OpenCV With The Raspberry Pi

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.

47 thoughts on “Using OpenCV With The Raspberry Pi

  1. 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 ?!

    1. 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.

      1. 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.

        1. 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.

          1. 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!

  2. 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.

      1. Well, Im sill curious to make tests with the camera module… At least camera preview/recording will be faster (I hope) and we won’t have to turn the resolution down… But then of course if you want to make some “heavy” processing… then you might hit the Pi’s limitations quite fast…

  3. 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. 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.

      1. 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!

        1. 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.

          1. 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.

      2. 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?

  5. 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..

  6. 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.

    1. 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.

      1. 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.

  7. 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..)

  8. 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.

  9. 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…)

    1. 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.

Leave a Reply to RobotCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.