tidied up last issues
[The-Artvertiser.git] / artvertiser / calibmodel.h
blob52d4c6e5eb2c30d0944b2ee1ae15d4728f56980d
1 #ifndef CALIBMODEL_H
2 #define CALIBMODEL_H
4 #include <cv.h>
5 #include <highgui.h>
6 #include <garfeild.h>
8 class CalibModel {
9 public:
10 CvPoint corners[4];
11 CvPoint artvert_corners[4];
13 LightMap map;
14 CamAugmentation augm;
16 CalibModel();
17 ~CalibModel();
19 void useModelFile( const char *modelfile );
21 bool buildCached(int nbcam, CvCapture *capture, bool cache, planar_object_recognizer &detector,
22 bool run_on_binoculars = false);
24 int getImageWidth() { return image_width; }
25 int getImageHeight() { return image_height; }
27 /// update the interactive training on binoculars
28 void interactiveTrainBinocularsUpdate(IplImage* frame, bool button_red, bool button_green, bool button_blue );
29 /// draw the interactive training on binucolurs
30 void interactiveTrainBinocularsDraw();
32 /// true if we're running interactive training on the binoculars
33 bool isInteractiveTrainBinocularsRunning() { return interactive_train_running; }
34 /// tell the interactive training to abort
35 void abortInteractiveTrainBinoculars() { if( interactive_train_running ) interactive_train_should_stop = true; }
37 /// true if learning is in progress
38 bool isLearnInProgress() { return learn_running; }
39 /// get the training progress message
40 const char* getLearnProgressMessage() { return progress_string; }
42 private:
43 IplImage *image;
45 int image_width, image_height;
47 const char *win;
48 const char *modelfile;
50 enum State { TAKE_SHOT, CORNERS, ARTVERT_CORNERS };
51 State state;
52 int grab;
53 static void onMouseStatic(int event, int x, int y, int flags, void* param);
54 void onMouse(int event, int x, int y, int flags);
55 bool interactiveSetup(CvCapture *capture);
57 bool interactiveTrainBinoculars();
58 IplImage* train_working_image, *train_shot;
59 IplTexture train_texture;
60 bool interactive_train_running;
61 bool train_should_proceed;
62 bool interactive_train_should_stop;
63 bool learn_running;
66 bool debounce_green, debounce_redblue;
67 int x, y;
68 int corner_index;
69 CvFont train_font;
71 static char progress_string[2048];
72 static void learnProgressionFunc( int phase, int current, int total );
76 #endif