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 | |
---|
3 | import glob |
---|
4 | from vision import * |
---|
5 | |
---|
6 | imagepath = "../no-redist/spacek-large/*.png" |
---|
7 | images = glob.glob(imagepath) |
---|
8 | w = 20 |
---|
9 | h = 30 |
---|
10 | pca = PCA(w*h) |
---|
11 | |
---|
12 | for image in images: |
---|
13 | im = Image(image) |
---|
14 | v = im.Scale(w,h).RGB2GRAY().ToFloatVector() |
---|
15 | pca.AddFeature(v) |
---|
16 | |
---|
17 | pca.Calculate() |
---|
18 | |
---|
19 | f = OpenFile("test.pca", "wb") |
---|
20 | pca.Save(f) |
---|
21 | CloseFile(f) |
---|
Note: See
TracBrowser
for help on using the repository browser.