/Users/lyon/j4p/src/face/TestFaceRecognition.java
|
1 package face;
2
3 import java.io.IOException;
4
5
6 public class TestFaceRecognition {
7
8 public static void main(String args[]) {
9
10 String dir = futils.Futil.getReadDirFile("select images") + "";
11 String file = futils.Futil.getReadFile("select suspect") + "";
12
13
14 try {
15 EigenFaceCreator creator = new EigenFaceCreator();
16 utils.Timer t = new utils.Timer();
17 t.start();
18 //creator.USE_CACHE = -1;
19 System.out.println("Constructing face-spaces from " + dir + " ...");
20 creator.readFaceBundles(dir);
21 t.stop();
22 t.report();
23 System.out.println("Comparing " + file + " ...");
24
25 String result = creator.checkAgainst(file);
26
27
28 System.out.println("Most closly reseambling: "
29 + result + " with " + creator.DISTANCE + " distance.");
30 } catch (IOException e) {
31 e.printStackTrace(); //To change body of catch statement use Options | File Templates.
32 } catch (IllegalArgumentException e) {
33 e.printStackTrace(); //To change body of catch statement use Options | File Templates.
34 } catch (ClassNotFoundException e) {
35 e.printStackTrace(); //To change body of catch statement use Options | File Templates.
36 }
37
38
39 }
40
41 static void prUsage() {
42 System.err.println(
43 "Usage: java TestFaceRecognition <directory of training images>"
44 + "<image to test against>");
45 }
46
47
48 }
49