Media Companion
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Media Companion

Discussion and development board for the program Media Companion.
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

 

 Insert <actor> and as role (show) as keyword IPTCs into actor images

Go down 
AuthorMessage
marked
Junior Member
Junior Member



Posts : 24
Join date : 2010-04-13

Insert <actor> and as role (show) as keyword IPTCs into actor images Empty
PostSubject: Insert <actor> and as role (show) as keyword IPTCs into actor images   Insert <actor> and as role (show) as keyword IPTCs into actor images Icon_minitimeTue Apr 13, 2010 12:22 pm

Hi

Being playing with image and face recognition in picasa, and so thought it'd be interesting to "face match' the images that are downloaded. Then I thought this could be extended to displaying within MC...

So first off I parsed (hackily) the .nfo files and extracted name, role and show|movie then used exiv2 (exiv2.org) and exiftool (http://owl.phy.queensu.ca/~phil/exiftool/) to update the keywords. see scripts below, yeah, sucks, takes too long, 4000 images about 1hour 20 at 1 update per sec. or in exiftools 4 hours at approx 4 secs per image, but then I haven't optimised exiftools commandline.

So exiv2 and exiftool can both be used as libraries, though you should explicitly limit exiftool as it will attempt to load all modules for it's image parsing so it can take several seconds per image.

if you really want to be clever then you could wait for picasa to image recognise and/or if you've done it yourself, get the image, parse .picasa.ini, then scan $APPDATA%\local\google\picasa2\db3\contacts\contacts.xml for a matching ID...
where id
http://www.google.com/support/forum/p/Picasa/thread?tid=0727103717c22cd7&hl=en
Quote :
The number encased in rect64() is a 64-bit hexadecimal number.
* Break that up into four 16-bit numbers.
* Divide each by the maximum unsigned 16-bit number (65535) and you'll have four numbers between 0 and 1.
* The four numbers remaining give you relative coordinates for the face rectangle: (left, top, right, bottom).
* If you want to end up with absolute coordinates, multiple the left and right by the image width and the top and bottom by the image height.

where .picasa.ini
[tv70927.jpg]
faces=rect64(24b12c5fbbbba468),2246eee59c330a01

similarly you could also do this with windows live gallery support. Please note that <id> of an image may not necessarily be the same on my machine as on yours.

note the below scripts used sed -r (regular expression support) and cygwin for grep and gawk support. all scripts are one line.

Code:
grep -A2 -E "<name>" */tvshow.nfo | sed -r "s/\/tvshow.nfo....//;s/<\/.*>//;s/<....>/: /;s/<.....>/: /;s/--//" | gawk 'BEGIN { FS="\n" ; RS=""}; {print $1 " : " $2 " : " $3} ' | grep "jpg" | gawk -F: '{print "exiv2 -M\"add Iptc.Application2.Keywords " $2 "\", -M\"add Iptc.Application2.Keywords  as " $4 "(" $1 ")\" W:" $7}' |sed "s/ \",/\"/g;s/ )\" W/)\" W/"

Code:
grep -A2 -E "<name>" */*.nfo | sed "s/.nfo[-:]/:/" |gawk -F/ '{print $2}' |sed "s/<//g;s/>/:/" |gawk 'BEGIN { FS="\n" ; RS=""}; {print $1 " : " $2 " : " $3} ' |gawk -F: '{print "exiftool -iptc:keywords+=\"" $3 ", as " $6 ", "$1 "\" ..\\actorthumbs" $9}' |sed "s/ ,/,/g"

w: is the drive letter of my media..

would give an output similar to the following
exiftool -iptc:keywords+="Angelina Jolie" -iptc:keywords+="as Jane Smith (Mr and Mrs Smith)" ..\actorthumbs\01\nm0001401.jpg
exiftool -iptc:keywords+="Angelina Jolie" -iptc:keywords+="as Kate Libby (Hackers)" ..\actorthumbs\01\nm0001401.jpg
exiftool -iptc:keywords+="Angelina Jolie" -iptc:keywords+="as Lara Croft (Lara Croft Tomb Raider The Cradle of Life)" ..\actorthumbs\01\nm0001401.jpg
exiftool -iptc:keywords+="Angelina Jolie" -iptc:keywords+="as Lara Croft (Lara Croft Tomb Raider)" ..\actorthumbs\01\nm0001401.jpg
exiftool -iptc:keywords+="Angelina Jolie" -iptc:keywords+="as Sara 'Sway' Wayland (Gone in 60 Seconds)" ..\actorthumbs\01\nm0001401.jpg

or exiv2 -M"add Iptc.Applications2.Keywords Angelina Jolie" -M"add Iptc.Applications2.Keywords "as Sara 'Sway' Wayland (Gone in 60 Seconds)" ..\actorthumbs\01\nm0001401.jpg

piped to actupdate, then for /f "delims=:" %f in (actupdate) do "%f" hoping that there are no semicolons in the file...

drawbacks include currently
actor name is entered multiple times as keywords,
if run multiple times then keywords are duplicated.
all tv actor images are characters, and this can be used to chain them together.

So if you can overlay a box and text on an image, you could bound the actor faces recognised and parsed from contact.xml, iptc keywords and popup their other shows, movies etc. e.g on a BSG 2003 fanart image, mousing over the bounding of apollo would auto select actor image and popup
Jamie Bamber
BSG 2003 as Lee "apollo" Adama
Law and Order UK as <role>

depending on which shows you have in the db.

I guess this would also require support in xbmc, where you could do "who is that person that I vaguely recognise", pause, screenshot,<image recognise>, etc...

I'll leave it up to your imagination as to what else you can come up with. Comments, thoughts, suggestions, (you are out of your tree!)

Mark
Back to top Go down
 
Insert <actor> and as role (show) as keyword IPTCs into actor images
Back to top 
Page 1 of 1
 Similar topics
-
» Missing last letter of actor's role after scraping/rescraping
» 1.987 - edit tv show info and multiple fanart images
» 3.317 - TV Show Batch rescraper not working for actor thumbs
» IMDB updated many poster images, update local images?
» nfo files created properly, but show doesnt show in the main browser.

Permissions in this forum:You cannot reply to topics in this forum
Media Companion :: Media Companion :: Feature Requests-
Jump to: