changes: generated annotated code but it still causes type errors + re-formatting...
[IRC.git] / Robust / src / Benchmarks / SSJava / EyeTrackingInfer / EyeDetector.java
index 11443ab58bc6de16bfe67e642883a3f2c313ba65..d162bc0c446c17931d94ab322e0109ed9f1a6b45 100644 (file)
  * @author Florian Frankenberger
  */
 
-
 class EyeDetector {
 
-  
   private int width;
-  
+
   private int height;
-  
+
   private int[] pixelBuffer;
-  
+
   double percent;
 
   public EyeDetector(Image image, Rectangle2D faceRect) {
@@ -57,18 +55,15 @@ class EyeDetector {
 
   }
 
-  
   public Point detectEye() {
-     Point eyePosition = null;
-     float brightness = 255f;
-    for ( int y = 0; y < height; ++y) {
-      for ( int x = 0; x < width; ++x) {
-         final int position = y * width + x;
-         final int[] color =
-            new int[] { (pixelBuffer[position] & 0xFF0000) >> 16,
-                (pixelBuffer[position] & 0x00FF00) >> 8, pixelBuffer[position] & 0x0000FF };
+    Point eyePosition = null;
+    float brightness = 255f;
+    for (int y = 0; y < height; ++y) {
+      for (int x = 0; x < width; ++x) {
+        int position = y * width + x;
+        int[] color = new int[] { (pixelBuffer[position] & 0xFF0000) >> 16, (pixelBuffer[position] & 0x00FF00) >> 8, pixelBuffer[position] & 0x0000FF };
         // System.out.println("("+x+","+y+")="+color[0]+" "+color[1]+" "+color[2]);
-         final float acBrightness = getBrightness(color);
+        float acBrightness = getBrightness(color);
 
         if (acBrightness < brightness) {
           eyePosition = new Point(x + (int) percent, y + (int) percent);
@@ -80,10 +75,9 @@ class EyeDetector {
     return eyePosition;
   }
 
-  
-  private static float getBrightness( int[] color) {
-     int min = Math.min(Math.min(color[0], color[1]), color[2]);
-     int max = Math.max(Math.max(color[0], color[1]), color[2]);
+  private static float getBrightness(int[] color) {
+    int min = Math.min(Math.min(color[0], color[1]), color[2]);
+    int max = Math.max(Math.max(color[0], color[1]), color[2]);
 
     return 0.5f * (max + min);
   }