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 #include "find_object/Header.h"
35 
36 #include <QMainWindow>
37 #include <QtCore/QSet>
38 #include <QtCore/QTimer>
39 #include <QtCore/QTime>
40 #include <QtCore/QMap>
41 #include <QtCore/QByteArray>
42 
43 #include <opencv2/opencv.hpp>
44 
45 namespace rtabmap
46 {
47 class PdfPlotCurve;
48 }
49 
50 class Ui_mainWindow;
51 class QLabel;
52 
53 namespace find_object {
54 
55 class ObjWidget;
56 class Camera;
57 class ParametersToolBox;
58 class AboutDialog;
59 class TcpServer;
60 class KeypointDetector;
61 class DescriptorExtractor;
62 class Vocabulary;
63 class FindObject;
64 
65 class FINDOBJECT_EXP MainWindow : public QMainWindow
66 {
67  Q_OBJECT
68 
69 public:
70  MainWindow(find_object::FindObject * findObject, find_object::Camera * camera = 0, QWidget * parent = 0);
71  virtual ~MainWindow();
72 
73  void setSourceImageText(const QString & text);
74 
75 protected:
76  virtual void closeEvent(QCloseEvent * event);
77  virtual void keyPressEvent(QKeyEvent *event);
78 
79 public Q_SLOTS:
80  void startProcessing();
81  void stopProcessing();
82  void pauseProcessing();
83  void update(const cv::Mat & image);
84  void update(const cv::Mat & image, const find_object::Header & header, const cv::Mat & depth, float depthConstant);
85 
86 private Q_SLOTS:
87  void loadSession();
88  void saveSession();
89  void loadSettings();
90  void saveSettings();
91  void loadObjects();
92  bool saveObjects();
93  void loadVocabulary();
94  void saveVocabulary();
95  void addObjectFromScene();
96  void addObjectsFromFiles(const QStringList & fileNames);
97  void addObjectsFromFiles();
98  void addObjectFromTcp(const cv::Mat & image, int id, const QString & filePath);
99  void loadSceneFromFile(const QStringList & fileNames);
100  void loadSceneFromFile();
101  void setupCameraFromVideoFile();
102  void setupCameraFromImagesDirectory();
103  void setupCameraFromTcpIp();
104  void removeObject(find_object::ObjWidget * object);
105  void removeObject(int id);
106  void removeAllObjects();
107  void updateObjectsSize();
108  void updateMirrorView();
109  void showHideControls();
110  void showObjectsFeatures();
111  void hideObjectsFeatures();
112  void updateObjects();
113  void notifyParametersChanged(const QStringList & param);
114  void moveCameraFrame(int frame);
115  void rectHovered(int objId);
116 
117 Q_SIGNALS:
118  void objectsFound(const find_object::DetectionInfo &, const find_object::Header & header, const cv::Mat & depth, float depthConstant);
119 
120 private:
121  bool loadSettings(const QString & path);
122  bool saveSettings(const QString & path) const;
123  int loadObjects(const QString & dirPath, bool recursive = false);
124  int saveObjects(const QString & dirPath);
125  void setupTCPServer();
126  int addObjectFromFile(const QString & filePath);
127  void showObject(find_object::ObjWidget * obj);
128  void updateObjectSize(find_object::ObjWidget * obj);
129  void updateVocabulary(const QList<int> & ids = QList<int>());
130  void updateObjects(const QList<int> & ids);
131 
132 private:
133  Ui_mainWindow * ui_;
139  QMap<int, find_object::ObjWidget*> objWidgets_;
140  QTime updateRate_;
144  QMap<int, QByteArray> imagesMap_;
145  QMap<QString, QVariant> lastObjectsUpdateParameters_; // ParametersMap
147  cv::Mat sceneImage_;
148 };
149 
150 } // namespace find_object
151 
152 #endif /* MainWindow_H_ */
bool param(const std::string &param_name, T &param_val, const T &default_val)
TcpServer * tcpServer_
Definition: MainWindow.h:146
#define FINDOBJECT_EXP
Definition: FindObjectExp.h:38
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
QMap< int, QByteArray > imagesMap_
Definition: MainWindow.h:144
rtabmap::PdfPlotCurve * likelihoodCurve_
Definition: MainWindow.h:136
QMap< QString, QVariant > lastObjectsUpdateParameters_
Definition: MainWindow.h:145
AboutDialog * aboutDialog_
Definition: MainWindow.h:138
FindObject * findObject_
Definition: MainWindow.h:135
rtabmap::PdfPlotCurve * inliersCurve_
Definition: MainWindow.h:137
const std::string header
Ui_mainWindow * ui_
Definition: MainWindow.h:133
QMap< int, find_object::ObjWidget * > objWidgets_
Definition: MainWindow.h:139


find_object_2d
Author(s): Mathieu Labbe
autogenerated on Mon Dec 12 2022 03:20:09