Changeset 96 for foam/trunk/eigentools/src/main.cpp
 Timestamp:
 07/29/2009 03:49:34 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

foam/trunk/eigentools/src/main.cpp
r94 r96 1 // Copyright (C) 2009 foam 2 // 3 // This program is free software; you can redistribute it and/or modify 4 // it under the terms of the GNU General Public License as published by 5 // the Free Software Foundation; either version 2 of the License, or 6 // (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU General Public License for more details. 12 // 13 // You should have received a copy of the GNU General Public License 14 // along with this program; if not, write to the Free Software 15 // Foundation, Inc., 59 Temple Place  Suite 330, Boston, MA 021111307, USA. 16 1 17 #define CV_NO_BACKWARD_COMPATIBILITY 2 18 … … 33 49 double scale = 1; 34 50 35 int w=50;36 int h=80;37 //int w=20;38 //int h=30;51 //int w=50; 52 //int h=80; 53 int w=20; 54 int h=30; 39 55 40 56 PCA pca(w*h); … … 46 62 glob_t g; 47 63 48 glob("../data/images/faces/ spaceklarge/*.png",GLOB_PERIOD,NULL,&g);64 glob("../data/images/faces/dave/*.png",GLOB_PERIOD,NULL,&g); 49 65 for (unsigned int n=0; n<g.gl_pathc; n++) 50 66 { … … 62 78 } 63 79 64 void TestPCA() 65 { 66 //Recalc(); 67 //FILE *f=fopen("spacek50x80.pca", "wb"); 68 //pca.Save(f); 69 70 FILE *f=fopen("../data/eigenspaces/spacek50x80.pca", "rb"); 80 PCA LoadPCA(string filename) 81 { 82 PCA pca(1); 83 FILE *f=fopen(filename.c_str(), "rb"); 71 84 pca.Load(f); 72 85 fclose(f); 86 return pca; 87 } 88 89 void TestPCA() 90 { 91 //Recalc(); 92 //FILE *f=fopen("davelight20x30.pca", "wb"); 93 //pca.Save(f); 94 pca = LoadPCA("../data/eigenspaces/spacek20x30.pca"); 95 96 PCA davelight = LoadPCA("davelight20x30.pca"); 97 //pca.Mult(davelight); 98 pca = davelight; 73 99 74 100 pca.Compress(0,100); … … 79 105 80 106 } 107 81 108 82 109 … … 298 325 299 326 static float t=0; 300 301 for (unsigned int i=0; i< 30; i++)302 { 303 camera.Blit(Image(w,h,1,(pca.GetEigenTransform().GetRowVector(i)*50 )/((i+1) * 1)+pca.GetMean()304 ),(i% 10)*(w+2),0+(i/10)*(h+2));327 cerr<<sin(t)<<endl; 328 for (unsigned int i=0; i<100; i++) 329 { 330 camera.Blit(Image(w,h,1,(pca.GetEigenTransform().GetRowVector(i)*50*sin(t))/((i+1) * 1)+pca.GetMean() 331 ),(i%30)*(w+2),0+(i/30)*(h+2)); 305 332 } 306 333
Note: See TracChangeset
for help on using the changeset viewer.