source: foam/trunk/python/build-pca.py @ 112

Revision 112, 342 bytes checked in by dave, 11 years ago (diff)

added python wrap

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3import glob
4from vision import *
5
6imagepath = "../no-redist/spacek-large/*.png"
7images = glob.glob(imagepath)
8w = 20
9h = 30
10pca = PCA(w*h)
11
12for image in images:
13        im = Image(image)
14        v = im.Scale(w,h).RGB2GRAY().ToFloatVector()
15        pca.AddFeature(v)
16
17pca.Calculate()
18
19f = OpenFile("test.pca", "wb")
20pca.Save(f)
21CloseFile(f)
Note: See TracBrowser for help on using the repository browser.