Rev Author Line No. Line
178 kaklik 1 #ifndef __MANDOWIZARD_HH
2 #define __MANDOWIZARD_HH
3  
4 #include <boost/shared_ptr.hpp>
5 #include "image.h"
6 #include "image_dc1394input.h"
7 #include "image_v4linput.h"
8 #include "rgba.h"
9 #include <QtGui/QDialog>
10 #include "cameraProjectorCalibration.hh"
11 #include "pointerRecognition.hh"
12 #include "ui_mandoWizard.hh"
13  
14 class CalibrateWidget;
15 class CrossWidget;
16 class SelectRectWidget;
17 class VideoWidget;
18  
19 class MandoWizard: public QDialog
20 {
21 Q_OBJECT
22 public:
23 typedef mimas::image_input< mimas::rgba< unsigned char > > Video;
24 typedef mimas::image_v4linput< mimas::rgba< unsigned char > > V4LInput;
25 typedef mimas::image_dc1394input< mimas::rgba< unsigned char > > DC1394Input;
26 typedef boost::shared_ptr< Video > VideoPtr;
27 typedef boost::shared_ptr< V4LInput > V4LInputPtr;
28 typedef boost::shared_ptr< DC1394Input > DC1394InputPtr;
29 typedef boost::numeric::ublas::vector< double > Vector;
30 MandoWizard( QWidget *parent = 0, Qt::WFlags = 0 );
31 PointerRecognitionPtr pointerRecognition;
32 VideoPtr input;
33 V4LInputPtr v4lInput;
34 DC1394InputPtr dc1394Input;
35 public slots:
36 void updateEnabled(void);
37 protected slots:
38 void calibrate();
39 void previousPage();
40 void nextPage();
41 void loadSearchPattern();
42 void loadProjectedPattern();
43 void reconnectCamera();
44 void displayCalibFrame(int);
45 void displayDifference(bool);
46 void grabReferenceImage();
47 void setThreshold(int);
48 void setSigma(double);
49 void setRange(int);
50 void startDrag();
51 void stopDrag();
52 void setCameraParameters(void);
53 protected:
54 virtual void timerEvent( QTimerEvent *e );
55 void showPage( int index );
56 bool loadImage( const char *title,
57 mimas::image< mimas::rgba< unsigned char > > &img );
58 void setupVideo(void);
59 void displayCalibResult( int index, bool diff );
60 VideoPtr camera(void) throw (mimas::mimasexception);
61 mimas::image< mimas::rgba< unsigned char > > grabColourFrame( bool twice = true )
62 throw (mimas ::mimasexception);
63 mimas::image< unsigned char > grabFrame(void) throw (mimas::mimasexception);
64 Ui::MandoWizard ui;
65 mimas::image< mimas::rgba< unsigned char > > searchPattern;
66 mimas::image< mimas::rgba< unsigned char > > projectedPattern;
67 VideoWidget *videoWidget;
68 VideoWidget *searchPatternWidget;
69 VideoWidget *projectedPatternWidget;
70 CrossWidget *calibFrameWidget;
71 SelectRectWidget *referenceImageWidget;
72 CrossWidget *segmentedWidget;
73 int videoTimer;
74 CalibrateWidget *calibrateWidget;
75 int calibTimer;
76 CameraProjectorCalibrationPtr cameraProjectorCalibration;
77 enum { Init = 0, First, Second, Third, Fourth, Fifth, Closing, Finished }
78 calibState;
79 int segmentationTimer;
80 int screenW;
81 int screenH;
82 int pointerTimer;
83 };
84  
85 #endif