MainWindow.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2011-2014, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef MAINWINDOW_H_
29 #define MAINWINDOW_H_
30 
31 #include "find_object/FindObjectExp.h" // DLL export/import defines
32 
34 
35 #include <QMainWindow>
36 #include <QtCore/QSet>
37 #include <QtCore/QTimer>
38 #include <QtCore/QTime>
39 #include <QtCore/QMap>
40 #include <QtCore/QByteArray>
41 
42 #include <opencv2/opencv.hpp>
43 
44 namespace rtabmap
45 {
46 class PdfPlotCurve;
47 }
48 
49 class Ui_mainWindow;
50 class QLabel;
51 
52 namespace find_object {
53 
54 class ObjWidget;
55 class Camera;
56 class ParametersToolBox;
57 class AboutDialog;
58 class TcpServer;
59 class KeypointDetector;
60 class DescriptorExtractor;
61 class Vocabulary;
62 class FindObject;
63 
64 class FINDOBJECT_EXP MainWindow : public QMainWindow
65 {
66  Q_OBJECT
67 
68 public:
69  MainWindow(find_object::FindObject * findObject, find_object::Camera * camera = 0, QWidget * parent = 0);
70  virtual ~MainWindow();
71 
72  void setSourceImageText(const QString & text);
73 
74 protected:
75  virtual void closeEvent(QCloseEvent * event);
76  virtual void keyPressEvent(QKeyEvent *event);
77 
78 public Q_SLOTS:
79  void startProcessing();
80  void stopProcessing();
81  void pauseProcessing();
82  void update(const cv::Mat & image);
83 
84 private Q_SLOTS:
85  void loadSession();
86  void saveSession();
87  void loadSettings();
88  void saveSettings();
89  void loadObjects();
90  bool saveObjects();
91  void loadVocabulary();
92  void saveVocabulary();
93  void addObjectFromScene();
94  void addObjectsFromFiles(const QStringList & fileNames);
95  void addObjectsFromFiles();
96  void addObjectFromTcp(const cv::Mat & image, int id, const QString & filePath);
97  void loadSceneFromFile(const QStringList & fileNames);
98  void loadSceneFromFile();
99  void setupCameraFromVideoFile();
100  void setupCameraFromImagesDirectory();
101  void setupCameraFromTcpIp();
102  void removeObject(find_object::ObjWidget * object);
103  void removeObject(int id);
104  void removeAllObjects();
105  void updateObjectsSize();
106  void updateMirrorView();
107  void showHideControls();
108  void showObjectsFeatures();
109  void hideObjectsFeatures();
110  void updateObjects();
111  void notifyParametersChanged(const QStringList & param);
112  void moveCameraFrame(int frame);
113  void rectHovered(int objId);
114 
115 Q_SIGNALS:
116  void objectsFound(const find_object::DetectionInfo &);
117 
118 private:
119  bool loadSettings(const QString & path);
120  bool saveSettings(const QString & path) const;
121  int loadObjects(const QString & dirPath, bool recursive = false);
122  int saveObjects(const QString & dirPath);
123  void setupTCPServer();
124  int addObjectFromFile(const QString & filePath);
125  void showObject(find_object::ObjWidget * obj);
126  void updateObjectSize(find_object::ObjWidget * obj);
127  void updateVocabulary(const QList<int> & ids = QList<int>());
128  void updateObjects(const QList<int> & ids);
129 
130 private:
131  Ui_mainWindow * ui_;
137  QMap<int, find_object::ObjWidget*> objWidgets_;
138  QTime updateRate_;
142  QMap<int, QByteArray> imagesMap_;
143  QMap<QString, QVariant> lastObjectsUpdateParameters_; // ParametersMap
145  cv::Mat sceneImage_;
146 };
147 
148 } // namespace find_object
149 
150 #endif /* MainWindow_H_ */
bool param(const std::string &param_name, T &param_val, const T &default_val)
TcpServer * tcpServer_
Definition: MainWindow.h:144
#define FINDOBJECT_EXP
Definition: FindObjectExp.h:38
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
QMap< int, QByteArray > imagesMap_
Definition: MainWindow.h:142
rtabmap::PdfPlotCurve * likelihoodCurve_
Definition: MainWindow.h:134
QMap< QString, QVariant > lastObjectsUpdateParameters_
Definition: MainWindow.h:143
AboutDialog * aboutDialog_
Definition: MainWindow.h:136
FindObject * findObject_
Definition: MainWindow.h:133
rtabmap::PdfPlotCurve * inliersCurve_
Definition: MainWindow.h:135
Ui_mainWindow * ui_
Definition: MainWindow.h:131
QMap< int, find_object::ObjWidget * > objWidgets_
Definition: MainWindow.h:137


find_object_2d
Author(s): Mathieu Labbe
autogenerated on Mon Jun 10 2019 13:21:31