Shotwell Faces Tool: Weekly Report 03 & 04
23/06/12 11:20
::[ NOTE: Spanish translation in http://sanva.net/blog/109/ ]
The schedule to this last two weeks was to write some demo code in Vala with GTK+ and OpenCV, to proof that we can get face detection feature in Shotwell. And I was trying to fight against OpenCV & GTK+ 3 incompatibilities, but I have lost.
I thought this would be easy, because I had written some working code to detect faces inside Shotwell using OpenCV at the end of last year. But the problem now is that Shotwell is using GTK+ 3, and the OpenCV highgui module, which is used to provide a simple multiplatform user interface —but also to load IPL images, the format that OpenCV functions expect— uses GTK+ 2, so they cannot be in the same process.
So, two problems I had to deal with:
OpenCV objdetect module dependencies with highgui module: The only modules that are essential to face detection are core and objdetect, but for some reason I don't know, objdetect have dependencies with highgui and so the highgui library is included in the binary if you include objdetect. I've submitted a bug for that at [1], but they canceled it —it seems that they don't care about integration of OpenCV with other programs... They said that I can compile OpenCV without highgui —and that's correct, everything works fine, but the problems are two:
- We would be adding the need of compile OpenCV —it's easy, by the way, I didn't have any problem doing it— to compile Shotwell.
Idon't know if there will be problems with the binary distributed Shotwell packages —in Ubuntu for example— since they would be linked against some version of OpenCV with no highgui and the OpenCV binaries in the system would probably have been compiled with it.
- The other problem is that, without highgui, we lose the ability to load IPL images, so I've needed to find a way to convert form GDK pixbufs —or Cairo surfaces— to IPL images... and I've been looking for some way to do it but I simply haven't found anything —until Álvaro Marcos Ramiro, one Spanish guy that I know he id this in the past —because I've found some fragments of his code and it's doing the thing, but the important part, the conversion between formats, was missing— answered my mail asking his help.
So, the second problem is solved, but there is still the problem with objdetect module dependencies with highgui module, so I've continued with and alternative way: I've created an independent program which would be called by Shotwell to perform face detection.
Starting from a test program you can find in the OpenCV official tarball [2] —in /samples/c/facedetect.cpp— I've created a helper program that process one image file and outputs it's faces information —you can see it in [3], please refer to the README file to get more info about the program or, of course, ask me whatever.
I started working on the integration of this new feature into Shotwell, but now I've returned to this simple program, since people at Yorba think that it is more important to proof that OpenCV can perform face detection in a reliable way, and also try to perform face recognition, one feature that would be really awesome if it works fine.
[1] http://code.opencv.org/issues/2024
[2] http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.1/
Tags: [en], Planet GNOME, Google Summer of Code, Shotwell