changes: 1) fixes problems in the original EyeTracking benchmark 2) fix a bug in...
[IRC.git] / Robust / src / Benchmarks / SSJava / EyeTrackingInfer / LEAImplementation.java
index b9dc7d39c9b3543a4e03fc2d2bfb2bedf8185aeb..3c2449c70e9be91bcbdf2da1eb5292c3821d4a1a 100644 (file)
  * @author Florian Frankenberger
  */
 
+
 public class LEAImplementation {
 
+  
   private ClassifierTree classifierTree;
 
-  private Rectangle2D lastRectangle;
 
   public LEAImplementation() {
     this.loadFaceData();
   }
 
-  public FaceAndEyePosition getEyePosition(Image image) {
-    if (image == null)
-      return null;
-    Rectangle2D faceRect = classifierTree.locateFaceRadial(image, lastRectangle);
-    if (faceRect.getWidth() > image.getWidth() || faceRect.getHeight() > image.getHeight()) {
-      return null;
-    }
-    EyePosition eyePosition = null;
-    if (faceRect != null) {
-      lastRectangle = faceRect;
-      faceRect = null;
-      Point point = readEyes(image, lastRectangle);
-      if (point != null) {
-        eyePosition = new EyePosition(point, lastRectangle);
-      }
-    } else {
-      lastRectangle = null;
-    }
-    System.out.println("eyePosition=" + eyePosition);
-
-    return new FaceAndEyePosition(lastRectangle, eyePosition);
-  }
-
-  private Point readEyes(Image image, Rectangle2D rect) {
-    EyeDetector ed = new EyeDetector(image, rect);
-    return ed.detectEye();
+  
+  
+  public FaceAndEyePosition getEyePosition( Image image) {
+    return classifierTree.getEyePosition(image);
   }
 
   public boolean needsCalibration() {