calibapp.h

00001 /* -- 2007-05-07 -- 
00002  *  ardev - an augmented reality library for robot developers
00003  *  Copyright 2005-2007 - Toby Collett (ardev _at_ plan9.net.nz)
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Lesser General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Lesser General Public
00016  *  License along with this library; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00018  *
00019  */
00020 
00080 #ifndef CALIBAPP_H
00081 #define CALIBAPP_H
00082 
00083 #include "../ui/calibapp_base.h"
00084 
00085 
00086 class Q3CanvasSprite;
00087 class Q3Canvas;
00088 class Q3CanvasView;
00089 
00090 #include <qlistview.h>
00091 
00092 #undef signals
00093 #include <libplayerc++/playerc++.h>
00094 #define signals protected
00095 
00096 using namespace PlayerCc;
00097 
00098 #include "camera.h"
00099 #include <ardev/ardev.h>
00100 #include <ardev/capture.h>
00101 #include <libthjc/geometry.h>
00102 
00103 
00104 class CalibApp : public QMainWindow, public Ui_CalibApp
00105 {
00106     Q_OBJECT
00107 
00108 public:
00109         CalibApp(int argc, char **argv, QWidget* parent = 0, Qt::WFlags flags = 0);
00110         virtual ~CalibApp() {};
00111 
00112         void ProcessImage();
00113 
00114         void LoadCalibPoints();
00115 
00116         // Command Line args
00117         int argc;
00118         char ** argv;
00119 
00120 public slots:
00121         void Idle();    
00122 
00123         void OriginalClicked();
00124         void ShowStageClicked();
00125         void CalibrateClicked();
00126 
00127         void calibChanged();
00128 
00129 
00130         void AcquireToggled(bool);
00131 
00132         void fileOpen();
00133         void fileSaveAs();
00134         
00135         void Load2DPoints();
00136         void Load3DPoints();
00137 
00138 
00139 protected:
00140         void ShowImage(const ARImage & im);
00141 
00142         ARImage Original;//, Threshold, Hough;
00143         ARImage Original_Backup;//, Threshold, Hough;
00144 #define NumStages 15
00145         ARImage Stages[NumStages];
00146 
00147         list<Line> Lines;
00148         vector<Point2D> OrderedPoints;
00149 
00150         bool Capturing;
00151         QTimer * AcquireTimer;
00152 
00153         // Player Position Variables
00154         PlayerClient * PClient;
00155         Position3dProxy * Pos;
00156         
00157         // Image Capture
00158         PlayerClient * camServer;
00159         CameraProxy * cp;
00160         ARImage Acquired;
00161         
00162         // Storage for real world calibration Points
00163         double CubePoints[27][3];
00164         double CubeOffset[3];
00165 
00166         // Calibration Results
00167         Camera cam;
00168 
00169         bool CalibrationDone;
00170 };
00171 
00172 
00173 
00174 #endif // CALIBAPP_H

SourceForge.net Logo Generated on Sat May 12 15:25:43 2007 for ardev by doxygen 1.5.1