Welcome to GNIKville...

Mon, 02 Feb 2009

Hacking iPhoto 09

So Apple has come out with the iPhoto 09 that introduces two features that are near and dear to my heart: geolocating (Places) and tagging (Faces).

I've done a fair amount of work on my daughters' photo blog on the geolocation front, diligently marking each picture with a lat/lon of where the picture was taken and creating a Google Maps mashup to show them all on the map. Going on 4 years worth of images now with 675 places mapped. Some complications are that due to disk space issues on my laptop I've had to move off a good deal of the old pictures onto a NAS in another iPhoto library (using iPhoto Library Manager). This presents a challenge on how to best use the new features (I shudder to think how long the initial face recognition will take over the wireless!)

My first question is: How do I integrate this with Places?

A bit of poking at what's new in the iPhoto library folder reveals a very pleasant surprise. All the image metadata, including Places and Faces are now in few sqlite3 databases! It just so happens that in my professional life I've been living and breathing sqlite for a year or two now. Very nice!

In iPhotoMain.db there is a SqUserPlace table with all your named places. When assigned to a photo the SqUserPlace.primaryKey will be entered in the corresponding SqPhotoInfo.namedPlace column. It should be very doable to dump out a mapping of images -> locations that I can integrate into my existing map.

On the faces side, everything seems to be in the face_blob.db and face.db files. I read elsewhere that you can start from scratch with faces by stopping iPhoto and deleting these two files (USE WITH CAUTION!). These seem a bit trickier but still doable. The face.db has a table called detected_face with an image_key column that maps back to the iPhotoMain SqPhotoInfo.primaryKey.

A few problems I see so far:

  • Given the above I don't think it would be feasible to share these between libraries. The SqUserPlace table would be possible if you could ensure that there was only one copy open at a time and that that table was reliably updated between them. The face.db on the other hand seems to be a non-starter because of the foreign key mapping between databases. This means that there is no way to share the file between two libraries even with copying before opening. (it might be possible to muck with the schema to replace the main tables with views that do a mapping to aux tables for each library but now you'd be talking about copying the db and mucking with the schema - creating a view - and would be in dangerous territory anytime there was an sw update)
  • I am unsure of the intended relationship between keyword tags and the new Faces and Places. Specifically what about images that have known people with their head turned or obscured? What if you still want to indicate that that person is _in_ the picture? If you create a "missing face" for them and assign it, say, to the back of their head, will that then mess up the recognition accuracy?
  • Exporting location information seems to be broken. So far when exporting with location information it seems that the result is that all EXIF metadata is lost from the image.

I am very interested in being able to get the information back out and will post here as I find more info.

 







Last modified: Fri, Mar 20 02:18:23 2009 GMT