2 * Copyright 2009 (c) Florian Frankenberger (darkblue.de)
4 * This file is part of LEA.
6 * LEA is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU Lesser General Public License as published by the Free
8 * Software Foundation, either version 3 of the License, or (at your option) any
11 * LEA is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with LEA. If not, see <http://www.gnu.org/licenses/>.
21 * No description given.
23 * @author Florian Frankenberger
25 public class LEAImplementation {
27 // private ClassifierTree classifierTree = null;
29 // private Rectangle2D lastRectangle;
31 public LEAImplementation() {
35 // public FaceAndEyePosition getEyePosition(BufferedImage image) {
39 // Rectangle2D faceRect = this.classifierTree.locateFaceRadial(image,
41 // EyePosition eyePosition = null;
42 // if (faceRect != null) {
44 // lastRectangle = faceRect;
45 // Point point = readEyes(image, faceRect);
46 // if (point != null) {
47 // eyePosition = new EyePosition(point, faceRect);
51 // return new FaceAndEyePosition(faceRect, eyePosition);
54 public boolean needsCalibration() {
59 * This method loads the faceData from a file called facedata.dat which should
60 * be within the jar-file
62 private void loadFaceData() {
64 FileInputStream inputFile = new FileInputStream("facedata.dat");
66 int numClassifier = Integer.parseInt(inputFile.readLine());
67 System.out.println("numClassifier=" + numClassifier);
68 for (int c = 0; c < numClassifier; c++) {
70 int numArea = Integer.parseInt(inputFile.readLine());
71 Classifier classifier = new Classifier(numArea);
73 for (int idx = 0; idx < numArea; idx++) {
75 Point fromPoint = new Point();
76 Point toPoint = new Point();
77 fromPoint.x = Integer.parseInt(inputFile.readLine());
78 fromPoint.y = Integer.parseInt(inputFile.readLine());
79 toPoint.x = Integer.parseInt(inputFile.readLine());
80 toPoint.y = Integer.parseInt(inputFile.readLine());
81 float size = Float.parseFloat(inputFile.readLine());
82 ScanArea area = new ScanArea(fromPoint, toPoint, size);
83 classifier.setScanArea(idx, area);
86 // parsing possibilities face yes
87 float array[] = new float[numArea];
88 for (int idx = 0; idx < numArea; idx++) {
89 array[idx] = Float.parseFloat(inputFile.readLine());
91 classifier.setPossibilitiesFaceYes(array);
93 // parsing possibilities face no
94 for (int idx = 0; idx < numArea; idx++) {
95 array[idx] = Float.parseFloat(inputFile.readLine());
97 classifier.setPossibilitiesFaceNo(array);
98 classifier.setPossibilityFaceYes(Integer.parseInt(inputFile.readLine()));
99 classifier.setPossibilityFaceNo(Integer.parseInt(inputFile.readLine()));
103 // private Point readEyes(BufferedImage image, Rectangle2D rect) {
105 // // now we cluster the black image points and try to find the inner eye
107 // * BlackHoleDetector bhd = new BlackHoleDetector(image, rect);
110 // * return bhd.getPosition();
113 // EyeDetector ed = new EyeDetector(image, rect);
114 // return ed.detectEye();