MainWindow.h
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2011-2014, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007     * Redistributions of source code must retain the above copyright
00008       notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright
00010       notice, this list of conditions and the following disclaimer in the
00011       documentation and/or other materials provided with the distribution.
00012     * Neither the name of the Universite de Sherbrooke nor the
00013       names of its contributors may be used to endorse or promote products
00014       derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
00020 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 */
00027 
00028 #ifndef MAINWINDOW_H_
00029 #define MAINWINDOW_H_
00030 
00031 #include "find_object/FindObjectExp.h" // DLL export/import defines
00032 
00033 #include "find_object/DetectionInfo.h"
00034 
00035 #include <QtGui/QMainWindow>
00036 #include <QtCore/QSet>
00037 #include <QtCore/QTimer>
00038 #include <QtCore/QTime>
00039 #include <QtCore/QMap>
00040 #include <QtCore/QByteArray>
00041 
00042 #include <opencv2/opencv.hpp>
00043 
00044 namespace rtabmap
00045 {
00046 class PdfPlotCurve;
00047 }
00048 
00049 class Ui_mainWindow;
00050 class QLabel;
00051 
00052 namespace find_object {
00053 
00054 class ObjWidget;
00055 class Camera;
00056 class ParametersToolBox;
00057 class AboutDialog;
00058 class TcpServer;
00059 class KeypointDetector;
00060 class DescriptorExtractor;
00061 class Vocabulary;
00062 class FindObject;
00063 
00064 class FINDOBJECT_EXP MainWindow : public QMainWindow
00065 {
00066         Q_OBJECT
00067 
00068 public:
00069         MainWindow(find_object::FindObject * findObject, find_object::Camera * camera = 0, QWidget * parent = 0);
00070         virtual ~MainWindow();
00071 
00072         void setSourceImageText(const QString & text);
00073 
00074 protected:
00075         virtual void closeEvent(QCloseEvent * event);
00076 
00077 public Q_SLOTS:
00078         void startProcessing();
00079         void stopProcessing();
00080         void pauseProcessing();
00081         void update(const cv::Mat & image);
00082 
00083 private Q_SLOTS:
00084         void loadSession();
00085         void saveSession();
00086         void loadSettings();
00087         void saveSettings();
00088         void loadObjects();
00089         bool saveObjects();
00090         void addObjectFromScene();
00091         void addObjectsFromFiles(const QStringList & fileNames);
00092         void addObjectsFromFiles();
00093         void addObjectFromTcp(const cv::Mat & image, int id, const QString & filePath);
00094         void loadSceneFromFile(const QStringList & fileNames);
00095         void loadSceneFromFile();
00096         void setupCameraFromVideoFile();
00097         void setupCameraFromImagesDirectory();
00098         void setupCameraFromTcpIp();
00099         void removeObject(find_object::ObjWidget * object);
00100         void removeObject(int id);
00101         void removeAllObjects();
00102         void updateObjectsSize();
00103         void updateMirrorView();
00104         void showHideControls();
00105         void showObjectsFeatures();
00106         void hideObjectsFeatures();
00107         void updateObjects();
00108         void notifyParametersChanged(const QStringList & param);
00109         void moveCameraFrame(int frame);
00110         void rectHovered(int objId);
00111 
00112 Q_SIGNALS:
00113         void objectsFound(const find_object::DetectionInfo &);
00114 
00115 private:
00116         bool loadSettings(const QString & path);
00117         bool saveSettings(const QString & path) const;
00118         int loadObjects(const QString & dirPath);
00119         int saveObjects(const QString & dirPath);
00120         void setupTCPServer();
00121         int addObjectFromFile(const QString & filePath);
00122         void showObject(find_object::ObjWidget * obj);
00123         void updateObjectSize(find_object::ObjWidget * obj);
00124         void updateVocabulary();
00125         void updateObjects(const QList<int> & ids);
00126 
00127 private:
00128         Ui_mainWindow * ui_;
00129         Camera * camera_;
00130         FindObject * findObject_;
00131         rtabmap::PdfPlotCurve * likelihoodCurve_;
00132         rtabmap::PdfPlotCurve * inliersCurve_;
00133         AboutDialog * aboutDialog_;
00134         QMap<int, find_object::ObjWidget*> objWidgets_;
00135         QTime updateRate_;
00136         QTime refreshStartTime_;
00137         int lowestRefreshRate_;
00138         bool objectsModified_;
00139         QMap<int, QByteArray> imagesMap_;
00140         QMap<QString, QVariant> lastObjectsUpdateParameters_; // ParametersMap
00141         TcpServer * tcpServer_;
00142         cv::Mat sceneImage_;
00143 };
00144 
00145 } // namespace find_object
00146 
00147 #endif /* MainWindow_H_ */


find_object_2d
Author(s): Mathieu Labbe
autogenerated on Thu Feb 11 2016 22:57:56