I just recently came across the new facial detection features in Picasa, and I have to say I am very impressed. This is a very useful feature and well implemented; once again Google has set the bar. Unfortunately, it is only available in the web version, and I have way too many photos to upload. Further, there seem to be more privacy concerns with a web version of a tool like this.
So, I was very excited when I saw a brief mention of presentation about OpenCV from a Ruhr.pm meeting (thanks to Yanick’s blog). Maybe this was the tool to implement facial detection/recognition in my photos locally.
Without going into much detail, OpenCV is a library of routines for facial detection, recognition, and similar computer vision tasks. So far, I have only experimented with the facial detection part and read a bit about the facial recognition routines. There is a handy Perl binding (Image::ObjectDetect) for the facial detection part. With it and reference to the slides from Ruhr.pm, I was able hack together a very simple script to look for and highlight faces in my photo collection.
While there were many false positives and some missed faces, OpenCV and the script show promise. Most of the missed faces were either very small or profiles, and there is another “cascade” (essentially a set of configuration presets to the detection algorithm) that might yield better results for profiles.
Reading about facial recognition from the OpenCV site was a bit underwhelming, though. Apparently OpenCV only supports one method of recognition, Principal Component Analysis. Which sounds like it has some sever limitations. From the site:
However it does have its weaknesses. PCA is translation variant – even if the images are shifted it wont recognize the face. It is Scale variant – even if the images are scaled it will be difficult to recognize. PCA is background variant – if you want to recognize face in an image with different background, it will be difficult to recognize. Above all, it is lighting variant – if the light intensity changes, the face wont be recognized that accurate.
Not exactly a great marketing pitch! PCA doesn’t sounds like the most suitable method for recognizing faces from arbitrary photos. I haven’t played with it yet, but that’s on the todo list.
To sum it all up, OpenCV looks like a great tool. I’ll update this blog as I continue to experiment with it and my homebrew version of PicasaWeb’s facial detection/recognition features. If anyone else has had experience with OpenCV or other facial detection/recognition tools (particularly those with Perl interfaces) I would love to hear about it.