Go to the documentation of this file.00001 #ifndef FCAM_AUTOFOCUS_H
00002 #define FCAM_AUTOFOCUS_H
00003
00004 #include <vector>
00005 #include "Frame.h"
00006
00009
00010 namespace FCam {
00011
00012 class Lens;
00013
00018 class AutoFocus {
00019 public:
00025 AutoFocus(FCam::Lens *l, FCam::Rect r = FCam::Rect());
00026
00028 void startSweep();
00029
00035 void update(const FCam::Frame &f);
00036
00038 bool focused() {return state == FOCUSED;}
00039
00041 bool idle() {return state == FOCUSED || state == IDLE;}
00042
00045 void setTarget(Rect r) {rect = r;}
00046
00047 private:
00048 Lens *lens;
00049
00050 struct Stats {
00051 float position;
00052 int sharpness;
00053 };
00054 std::vector<Stats> stats;
00055 enum {IDLE = 0, HOMING, SWEEPING, SETTING, FOCUSED} state;
00056
00057 Rect rect;
00058 };
00059
00060 }
00061
00062 #endif