Entries tagged face recognition webcam

pam_face_authentication with Ubuntu 9.10(Karmic Koala) + GDM + Speedlink Webcam

Posted on 3. Mai 2010 Comments

There are probably several ways to install OpenCV. I decided to compile it by myself, because the .deb-package(found here) collided with lib-…something and that was definitely necessary for pam_face_authentication, though that happened on my Toshiba M10 with Lucid Lynx 10.04 and not on the Karmic Laptop.

Anyway, even if it works for you, this definitely doesn’t hurt. Download the latest version of OpenCV(2.1.0 at the time) here and follow the very same Installation Guide:

cd ~/projects/OpenCV-2.1.0
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..
make
make install
export LD_LIBRARY_PATH=~/projects/OpenCV-2.1.0/release/lib:$LD_LIBRARY_PATH
sudo ldconfig

This should work without any error messages, which – of course – it didn’t. For example, I had to install libqt4-dev and qt4-make and a couple of others, just have a look at synaptic or apt-cache and try to google the error message. Also took quite a while.

Now download the source code from http://code.google.com/p/pam-face-authentication/ , my version is 0.3. Then follow the video instructions:

cd pam_face_authentication-0.3
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=/usr ..
make
sudo make install

Same thing, should work perfectly fine. Try to google error messages, if you get any. On my Toshiba with Lucid I got loads of error messages, don’t know what went wrong, but the cmake command just doesn’t work. On Karmic however no problem at all.

Next thing was nearly more difficult: installing a webcam. As I posted before, my Speedlink SL-6810 worked out of the box with camorama, but somehow I couldn’t get it to work. Turns out you need sudo(root privilege) to open /dev/video0, duh!. Same thing with cheese or other programs for webcams. These programs are designed to use libv4l libraries. qt-facetrainer, the program you need to capture a couple of sets for the recognition of your face, however has to be told to use these for this specific webcam.
Try

sudo LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so qt-facetrainer

(Thanks to rohan.anil and mystercoco)

So once you got your camera working, we’ll try to implement the whole thing into GDM, which I thought is pretty complicated but is actually quite easy. Thanks again to Rohan’s Blog:
Just add this line:

auth sufficient pam_face_authentication.so enableX

to /etc/pam.d/gdm, as it is said in his blog. Works fine for Karmic, can’t say anything about Lucid.
For my webcam, you’ll also need the libv4l for login, so create a /etc/ld.so.preload and just write

/usr/lib/libv4l/v4l1compat.so

in it. This will provide GDM with any information required to login by face authentication.

That’s it. Leave comments if there are any questions:)

Weblinks