source: libs/suds/python/expression.py @ 204

Revision 204, 839 bytes checked in by dave, 10 years ago (diff)

added dot product

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3import glob,string
4from suds import *
5from faces import *
6       
7# just try projecting onto vectors that seem 'happy'
8
9#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10def print_weight(filename,param,pca,w,h):
11        i = Image(filename)
12        v = i.Scale(w,h).RGB2GRAY().ToFloatVector()
13        p = pca.Project(v)
14        print(p[param])
15
16pca = load_pca("../data/eigenspaces/yalefaces-30x50.pca")
17w = 30
18h = 50
19filename = "../data/images/faces/dave/expression/normal.png"
20
21print("normal=")
22print_weight("../data/images/faces/dave/expression/normal.png",13,pca,w,h)
23print("happy=")
24print_weight("../data/images/faces/dave/expression/happy.png",13,pca,w,h)
25print("angry=")
26print_weight("../data/images/faces/dave/expression/angry.png",13,pca,w,h)
27print("grimace=")
28print_weight("../data/images/faces/dave/expression/grimace.png",13,pca,w,h)
Note: See TracBrowser for help on using the repository browser.