Raspberry Pi + Face tracking

Hello OF-community.

I have two questions regarding performance of the Raspberry Pi in combination with OF.

Operating system:
Raspbian 3.6.11+

Hardware:
Raspberry Pi Mod. B (512MB RAM)
Webcam Logitech C270
Powered USB2.0-Hub Vivanco
Intenso SDHC 16GB (Class 4)

I put together a programm which is based on opencv driven face detection. It paints a matte over every detected face.

However, there are no bug reports but the program is way too slow; like 1 frame every other 15 seconds. I tried out different resolutions and framerates.

  • Do you have any experience reports or an idea on which side the problem most certainly occurs?
  • Is SD driven Raspberry not the proper device for face detection stuff?

I would appreciate any hints, thank you very much in advance.

All the best,

ynk

hey ynk…

There are two working solutions from my experience doing a couple opencv Projects using the Pi (512MB RAM)

basically you should try get a webcam that can grab and allocate on 160x120 resolution.

This gave the best results for me performance wise… (60+fps)

Also The PSEYE does Good but it can’t do 160x120 so this makes it a bit more Ram intensive but what you can do with PSEYE is use ofxCvGrayscaleImage::warpIntoMe() to scale 320x240 into 160x120 this gives you better results.

Also… play with the memory split thing.

lot’s of information in this topic:

http://forum.openframeworks.cc/t/raspberry-pi+of—questions/11764/75

thank you kkkkkkkk,
i will play around with the memory split and see whether i can get such a camera soon.

to be honest the PSEYE might be better for what you are trying to do… I was working with blobs, so I don’t really need much resolution. But for Haar you might need more clarity, unless your detection is closer than 2 meters… So Try see if your project works with 160x120 on your laptop and then proceed to buy one… (they are really cheap to be honest)

I am positive that For what you are trying to do, pseye will do the best job…
a 160x120 camera will give you a bit more ram to work around… but you might loose in face detection sensitivity…

hi there,
i’m playing around with the ofxomxplayer addon on raspberrypi. it works really fine! Now I’d like to use opencv together with ofxomxplayer but i’m not sure if that’s possible. the opencv example (examples->addons->opencvexample) works, but i can’t include “ofxopencv.h” in “testapp.cpp” in the ofxomxplayer-directory (openFrameworks/apps/myApps/ofxOMXPlayer).

Something to do with this hint?
“This is not currently setup to run in the openFrameworks/addons folder. Clone into openFrameworks/apps/myApps/ofxOMXPlayer”

Is there a way getting this together?

Thx
Oli

doktorsuarez - ofxOMXPlayer should work with other addons.

Try adding a file to the project directory called addons.make

addons.make should simply have this inside of it

ofxOpenCv

edit: here is an example addons.make file that has a few addons
https://github.com/andreasmuller/RaspberryPiWorkshop/blob/master/NetworkedCV/addons.make

hi jvcleave,
thank you very much!

oli

if you grab the purpose built camera for the Pi, it connects straight to the GPU rather than through the USB hub, so it is much faster… or so says the latest edition of the MagPi:

http://issuu.com/themagpi/docs/issue14final?e=4599523/3821886

yeah - the native raspberry pi camera is very nice and doesn’t have the USB CPU overhead.

I’ve started an ofxAddon to be able to use it (haven’t tested OpenCV with it yet) but the project is available here:
https://github.com/jvcleave/omxCameraApp

1 Like

jvcleave,

do you have tutorial on how to use omxCameraApp or integrate it into existing examples that relied in the past on USB based cameras and the videoGrabber?

I’m a bit of a noob with OF and raspberryPi but do want to get my video based projects (from Mac) ported over to RaspberryPi where I’ll be using the Pi Camera Module.

I hope this isn’t a hijacking of the thread

We are actually in the process of writing a tutorial but it is not finished yet.

I am trying to make it as much like ofVideoGrabber as possible but there will be differences

Hi,
I tried the ofxRPiCameraVideoGrabber addon and it works great! Now I want to try it with ofxOpenCv but I have difficulties understanding how to send the camera data to it. As I understand only the texture is available from the camera and I cannot retrieve the pixels to send them to a CvColorImage.

Or is there another way to send the camera image to openCv?

1 Like

Not sure if anyone is interested, but i’ve compiled Kyle Mcdonald’s ofxCv library on the pi. I altered the Utilites.h file with these adjustments mentioned here: https://github.com/danoli3/ofxCv/commit/436070c23efafbf9fb46606051aabd34589d282e

Not sure if this breaks anything else, but tested with the example-face @ 320x240 30fps

2 Likes

I purchased a Rpi camera board from farnell site http://it.farnell.com/raspberry-pi/rpi-camera-board/raspberry-pi-camera-board-5mp/dp/2302279, and i would to use with ARToolkit addon, so i’m really interested to use ofxCv instead of ofxOpenCV addon ( because i don’t see a way - ready to use - now to send pixel data). i will inform of my progres in the next days when my rpi camera will arrive…

these changes https://github.com/danoli3/ofxCv/commit/436070c23efafbf9fb46606051aabd34589d282e are only in your repo?

Thanks!

not my repo, @danoli3 repo. From what I gathered, yes its not in the official addon release.

Thanks for the info @danielJay, sorry for the miserunderstanding. Returning to the topic: i found a solution in this post ofxRPiCameraVideoGrabber + ofxOpenCv in which you also partecipate; if someone else need… also the adafuit tut. is super useful: http://learn.adafruit.com/creepy-face-tracking-portrait/overview and the github code https://github.com/tdicola/creepyportrait

Definitely! I think @bakercp and @jvcleave were the contributors to consolidating a more “oF friendly” version of the RPi camera with a custom class/objects/functions etc.