Changeset 111 for foam/trunk/eigentools/src
 Timestamp:
 08/06/2009 11:30:26 AM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

foam/trunk/eigentools/src/main.cpp
r97 r111 49 49 double scale = 1; 50 50 51 //int w=50;52 //int h=80;53 int w=20;54 int h=30;51 int w=50; 52 int h=80; 53 //int w=20; 54 //int h=30; 55 55 56 56 PCA pca(w*h); … … 123 123 //FILE *f=fopen("davelight20x30.pca", "wb"); 124 124 //pca.Save(f); 125 pca = LoadPCA("../data/eigenspaces/spacek20x30.pca"); 126 PCA subspace = LoadPCA("daveresynthedsub.pca"); 127 128 //pca.Compress(0,10); 129 //pca.Compress(0,30); 125 pca = LoadPCA("../noredist/eigenspaces/spacek50x80.pca"); 126 //PCA subspace = LoadPCA("../data/eigenspaces/davelightspacek20x30.pca"); 130 127 131 128 //pca.EigenTransform() *= subspace.EigenTransform().Transposed(); 132 129 133 PCA davesubspace = MakeSubspace(pca,"../data/images/faces/dave/*.png");134 SavePCA(davesubspace,"davelightspacek20x30.pca");130 //PCA davesubspace = MakeSubspace(pca,"../data/images/faces/dave/*.png"); 131 //SavePCA(davesubspace,"davelightspacek20x30.pca"); 135 132 133 pca.Compress(0,100); 134 136 135 src = src.Scale(w,h).RGB2GRAY(); 137 136 Vector<float> d(src.ToFloatVector()); … … 361 360 static float t=0; 362 361 363 for (unsigned int i=0; i<10; i++) 364 { 365 //camera.Blit(Image(w,h,1,(pca.GetEigenTransform().GetRowVector(i)*50*sin(t))/((i+1) * 1) //+pca.GetMean() 366 // ),(i%30)*(w+2),0+(i/30)*(h+2)); 367 camera.Blit(Image(w,h,1,pca.GetEigenTransform().GetRowVector(i)*3 //+pca.GetMean() 368 ),(i%30)*(w+2),0+(i/30)*(h+2)); 369 } 370 371 t+=0.1; 372 373 camera.Blit(Image(w,h,1,pca.GetMean()),0,300); 374 camera.Blit(src,60,300); 375 camera.Blit(Image(w,h,1,pca.Synth(params)),120,300); 362 for (unsigned int i=0; i<100; i++) 363 { 364 camera.Blit(Image(w,h,1,(pca.GetEigenTransform().GetRowVector(i)*100*sin(t))/((i+1) * 0.5)+pca.GetMean() 365 ),(i%12)*(w+2),0+(i/12)*(h+2)); 366 //camera.Blit(Image(w,h,1,pca.GetEigenTransform().GetRowVector(i)*5+pca.GetMean() 367 // ),(i%10)*(w+2),0+(i/10)*(h+2)); 368 } 369 370 t+=0.05; 371 372 static int frame=0; 373 char fn[256]; 374 snprintf(fn,256,"out%06d.jpg",frame); 375 cvSaveImage(fn,camera.m_Image); 376 frame++; 377 378 //camera.Blit(Image(w,h,1,pca.GetMean()),0,300); 379 //camera.Blit(src,60,300); 380 //camera.Blit(Image(w,h,1,pca.Synth(params)),120,300); 376 381 377 382 cvShowImage("result", camera.m_Image);
Note: See TracChangeset
for help on using the changeset viewer.