2011-12-02 18:34:08 +00:00
|
|
|
/*
|
2014-08-06 13:43:29 +00:00
|
|
|
Copyright (c) 2011-2014, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
|
* Neither the name of the Universite de Sherbrooke nor the
|
|
|
|
|
names of its contributors may be used to endorse or promote products
|
|
|
|
|
derived from this software without specific prior written permission.
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
2014-08-11 15:49:53 +00:00
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
2014-08-06 13:43:29 +00:00
|
|
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*/
|
2011-10-25 15:48:19 +00:00
|
|
|
|
|
|
|
|
#ifndef MAINWINDOW_H_
|
|
|
|
|
#define MAINWINDOW_H_
|
|
|
|
|
|
2014-07-31 20:11:46 +00:00
|
|
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
|
|
|
|
|
2014-08-04 01:33:52 +00:00
|
|
|
#include "find_object/DetectionInfo.h"
|
|
|
|
|
|
2011-10-25 15:48:19 +00:00
|
|
|
#include <QtGui/QMainWindow>
|
|
|
|
|
#include <QtCore/QSet>
|
|
|
|
|
#include <QtCore/QTimer>
|
|
|
|
|
#include <QtCore/QTime>
|
2012-08-28 13:44:57 +00:00
|
|
|
#include <QtCore/QMap>
|
|
|
|
|
#include <QtCore/QByteArray>
|
2011-10-25 15:48:19 +00:00
|
|
|
|
2014-06-19 21:52:04 +00:00
|
|
|
#include <opencv2/opencv.hpp>
|
2014-05-11 23:57:08 +00:00
|
|
|
|
2014-08-06 13:43:29 +00:00
|
|
|
namespace rtabmap
|
|
|
|
|
{
|
|
|
|
|
class PdfPlotCurve;
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-25 15:48:19 +00:00
|
|
|
class Ui_mainWindow;
|
2014-08-06 13:43:29 +00:00
|
|
|
class QLabel;
|
|
|
|
|
|
|
|
|
|
namespace find_object {
|
|
|
|
|
|
2011-11-15 16:37:40 +00:00
|
|
|
class ObjWidget;
|
2011-10-25 15:48:19 +00:00
|
|
|
class Camera;
|
|
|
|
|
class ParametersToolBox;
|
2011-11-24 19:11:30 +00:00
|
|
|
class AboutDialog;
|
2014-05-05 23:08:01 +00:00
|
|
|
class TcpServer;
|
2014-06-19 21:52:04 +00:00
|
|
|
class KeypointDetector;
|
|
|
|
|
class DescriptorExtractor;
|
|
|
|
|
class Vocabulary;
|
2014-07-31 19:02:31 +00:00
|
|
|
class FindObject;
|
2011-10-25 15:48:19 +00:00
|
|
|
|
2014-07-31 20:11:46 +00:00
|
|
|
class FINDOBJECT_EXP MainWindow : public QMainWindow
|
2011-10-25 15:48:19 +00:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2014-08-06 14:09:55 +00:00
|
|
|
MainWindow(find_object::FindObject * findObject, find_object::Camera * camera = 0, QWidget * parent = 0);
|
2011-10-25 15:48:19 +00:00
|
|
|
virtual ~MainWindow();
|
|
|
|
|
|
2012-02-04 22:48:35 +00:00
|
|
|
void setSourceImageText(const QString & text);
|
2011-11-23 22:04:58 +00:00
|
|
|
|
2011-10-25 15:48:19 +00:00
|
|
|
protected:
|
|
|
|
|
virtual void closeEvent(QCloseEvent * event);
|
|
|
|
|
|
2014-07-08 19:55:03 +00:00
|
|
|
public Q_SLOTS:
|
2011-11-23 19:12:41 +00:00
|
|
|
void startProcessing();
|
|
|
|
|
void stopProcessing();
|
2012-01-30 03:16:30 +00:00
|
|
|
void pauseProcessing();
|
2014-08-03 21:35:28 +00:00
|
|
|
void update(const cv::Mat & image);
|
2011-11-23 19:12:41 +00:00
|
|
|
|
2014-07-08 19:55:03 +00:00
|
|
|
private Q_SLOTS:
|
2015-01-09 22:44:16 +00:00
|
|
|
void loadSession();
|
|
|
|
|
void saveSession();
|
2014-03-24 21:11:02 +00:00
|
|
|
void loadSettings();
|
|
|
|
|
void saveSettings();
|
2011-10-25 15:48:19 +00:00
|
|
|
void loadObjects();
|
2012-02-04 00:11:11 +00:00
|
|
|
bool saveObjects();
|
2012-02-04 22:15:32 +00:00
|
|
|
void addObjectFromScene();
|
2014-12-22 21:56:10 +00:00
|
|
|
void addObjectsFromFiles(const QStringList & fileNames);
|
2012-01-30 00:54:23 +00:00
|
|
|
void addObjectsFromFiles();
|
2014-12-22 21:56:10 +00:00
|
|
|
void loadSceneFromFile(const QStringList & fileNames);
|
2012-01-30 00:54:23 +00:00
|
|
|
void loadSceneFromFile();
|
2012-01-30 03:16:30 +00:00
|
|
|
void setupCameraFromVideoFile();
|
2012-08-28 20:06:43 +00:00
|
|
|
void setupCameraFromImagesDirectory();
|
2014-05-21 21:31:42 +00:00
|
|
|
void setupCameraFromTcpIp();
|
2014-08-06 14:09:55 +00:00
|
|
|
void removeObject(find_object::ObjWidget * object);
|
2012-02-04 00:11:11 +00:00
|
|
|
void removeAllObjects();
|
2012-08-28 13:44:57 +00:00
|
|
|
void updateObjectsSize();
|
|
|
|
|
void updateMirrorView();
|
2012-08-28 20:06:43 +00:00
|
|
|
void showHideControls();
|
2014-12-23 21:22:18 +00:00
|
|
|
void showObjectsFeatures();
|
|
|
|
|
void hideObjectsFeatures();
|
2012-01-28 01:00:23 +00:00
|
|
|
void updateObjects();
|
2012-08-29 19:04:14 +00:00
|
|
|
void notifyParametersChanged(const QStringList & param);
|
2012-08-28 20:06:43 +00:00
|
|
|
void moveCameraFrame(int frame);
|
2014-05-13 17:47:59 +00:00
|
|
|
void rectHovered(int objId);
|
2011-11-23 18:58:55 +00:00
|
|
|
|
2014-07-08 19:55:03 +00:00
|
|
|
Q_SIGNALS:
|
2014-08-06 14:09:55 +00:00
|
|
|
void objectsFound(const find_object::DetectionInfo &);
|
2011-10-25 15:48:19 +00:00
|
|
|
|
|
|
|
|
private:
|
2014-07-31 19:02:31 +00:00
|
|
|
bool loadSettings(const QString & path);
|
2015-01-09 22:44:16 +00:00
|
|
|
bool saveSettings(const QString & path) const;
|
2014-07-31 19:02:31 +00:00
|
|
|
int loadObjects(const QString & dirPath);
|
|
|
|
|
int saveObjects(const QString & dirPath);
|
2014-05-05 23:08:01 +00:00
|
|
|
void setupTCPServer();
|
2014-07-31 19:02:31 +00:00
|
|
|
bool addObjectFromFile(const QString & filePath);
|
2014-08-06 14:09:55 +00:00
|
|
|
void showObject(find_object::ObjWidget * obj);
|
|
|
|
|
void updateObjectSize(find_object::ObjWidget * obj);
|
2014-07-31 19:02:31 +00:00
|
|
|
void updateVocabulary();
|
2011-10-25 15:48:19 +00:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Ui_mainWindow * ui_;
|
|
|
|
|
Camera * camera_;
|
2014-07-31 19:02:31 +00:00
|
|
|
FindObject * findObject_;
|
2012-08-28 13:44:57 +00:00
|
|
|
rtabmap::PdfPlotCurve * likelihoodCurve_;
|
2014-05-11 23:57:08 +00:00
|
|
|
rtabmap::PdfPlotCurve * inliersCurve_;
|
2011-11-24 19:11:30 +00:00
|
|
|
AboutDialog * aboutDialog_;
|
2014-08-06 14:09:55 +00:00
|
|
|
QMap<int, find_object::ObjWidget*> objWidgets_;
|
2011-10-25 15:48:19 +00:00
|
|
|
QTime updateRate_;
|
2011-11-23 19:12:41 +00:00
|
|
|
QTime refreshStartTime_;
|
|
|
|
|
int lowestRefreshRate_;
|
2012-02-04 00:11:11 +00:00
|
|
|
bool objectsModified_;
|
2012-08-28 13:44:57 +00:00
|
|
|
QMap<int, QByteArray> imagesMap_;
|
2014-05-20 15:52:25 +00:00
|
|
|
QMap<QString, QVariant> lastObjectsUpdateParameters_; // ParametersMap
|
2014-07-31 19:02:31 +00:00
|
|
|
TcpServer * tcpServer_;
|
|
|
|
|
cv::Mat sceneImage_;
|
2011-10-25 15:48:19 +00:00
|
|
|
};
|
|
|
|
|
|
2014-08-06 13:43:29 +00:00
|
|
|
} // namespace find_object
|
|
|
|
|
|
2011-10-25 15:48:19 +00:00
|
|
|
#endif /* MainWindow_H_ */
|