Auto Exposure:

  - Filter results down to the three best.
  - Changing exposure based on distance to the target or at random.
  - Plumb exposure through the debug framework.
  - Refactor into target finder.

Change-Id: Ia083f56859938bf0825472fd15d248c545f6f2fc
diff --git a/aos/vision/debug/debug_framework.h b/aos/vision/debug/debug_framework.h
index a46812f..d8ed4a1 100644
--- a/aos/vision/debug/debug_framework.h
+++ b/aos/vision/debug/debug_framework.h
@@ -39,6 +39,16 @@
   virtual std::function<void(uint32_t)> RegisterKeyPress() {
     return std::function<void(uint32_t)>();
   }
+
+  // The DebugFramework will tells us where to call to get the camera.
+  void InstallSetExposure(std::function<void(int)> set_exp) {
+    set_exposure_ = set_exp;
+  }
+  void SetExposure(int abs_exp) {
+    set_exposure_(abs_exp);
+  }
+ private:
+  std::function<void(int)> set_exposure_;
 };
 
 // For ImageSource implementations only. Allows registering key press events
@@ -51,6 +61,12 @@
     key_press_events_.emplace_back(std::move(key_press_event));
   }
 
+  // The camera will tell us where to call to set exposure.
+  void InstallSetExposure(std::function<void(int)> set_exp) {
+    set_exposure_ = std::move(set_exp);
+  }
+  void SetExposure(int abs_exp) { set_exposure_(abs_exp); }
+
   // The return value bool here for all of these is
   // if the frame is "interesting" ie has a target.
   virtual bool NewJpeg(DataRef data) = 0;
@@ -76,6 +92,8 @@
 
  private:
   std::vector<std::function<void(uint32_t)>> key_press_events_;
+
+  std::function<void(int)> set_exposure_;
 };
 
 // Implemented by each source type. Will stream frames to