2011-12-02 18:34:08 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
|
|
|
|
*/
|
2011-10-25 15:48:19 +00:00
|
|
|
|
|
|
|
|
#ifndef MAINWINDOW_H_
|
|
|
|
|
#define MAINWINDOW_H_
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
#include <opencv2/core/core.hpp>
|
|
|
|
|
#include <opencv2/features2d/features2d.hpp>
|
|
|
|
|
#include <opencv2/imgproc/imgproc_c.h>
|
|
|
|
|
|
|
|
|
|
class Ui_mainWindow;
|
2011-11-15 16:37:40 +00:00
|
|
|
class ObjWidget;
|
2011-10-25 15:48:19 +00:00
|
|
|
class Camera;
|
|
|
|
|
class ParametersToolBox;
|
|
|
|
|
class QLabel;
|
2011-11-24 19:11:30 +00:00
|
|
|
class AboutDialog;
|
2011-10-25 15:48:19 +00:00
|
|
|
|
2012-08-28 13:44:57 +00:00
|
|
|
namespace rtabmap
|
|
|
|
|
{
|
|
|
|
|
class PdfPlotCurve;
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-25 15:48:19 +00:00
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2011-11-23 16:44:14 +00:00
|
|
|
MainWindow(Camera * camera = 0, QWidget * parent = 0);
|
2011-10-25 15:48:19 +00:00
|
|
|
virtual ~MainWindow();
|
|
|
|
|
|
2012-02-04 22:38:28 +00:00
|
|
|
int loadObjects(const QString & dirPath);
|
2012-02-04 00:11:11 +00:00
|
|
|
void saveObjects(const QString & dirPath);
|
2011-11-23 18:58:55 +00:00
|
|
|
|
2011-11-23 22:04:58 +00:00
|
|
|
ParametersToolBox * parametersToolBox() const;
|
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);
|
|
|
|
|
|
2011-11-23 19:12:41 +00:00
|
|
|
public slots:
|
|
|
|
|
void startProcessing();
|
|
|
|
|
void stopProcessing();
|
2012-01-30 03:16:30 +00:00
|
|
|
void pauseProcessing();
|
2011-11-23 19:12:41 +00:00
|
|
|
|
2011-10-25 15:48:19 +00:00
|
|
|
private slots:
|
|
|
|
|
void loadObjects();
|
2012-02-04 00:11:11 +00:00
|
|
|
bool saveObjects();
|
2012-02-04 22:15:32 +00:00
|
|
|
void addObjectFromScene();
|
2012-01-30 00:54:23 +00:00
|
|
|
void addObjectsFromFiles();
|
|
|
|
|
void loadSceneFromFile();
|
2012-01-30 03:16:30 +00:00
|
|
|
void setupCameraFromVideoFile();
|
2012-08-28 20:06:43 +00:00
|
|
|
void setupCameraFromImagesDirectory();
|
2011-11-15 16:37:40 +00:00
|
|
|
void removeObject(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();
|
2011-11-23 18:58:55 +00:00
|
|
|
void update(const cv::Mat & image);
|
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);
|
2011-11-23 18:58:55 +00:00
|
|
|
|
|
|
|
|
signals:
|
2012-01-04 21:08:42 +00:00
|
|
|
void objectsFound(const QMap<int, QPair<QRect, QTransform> > &);
|
2011-10-25 15:48:19 +00:00
|
|
|
|
|
|
|
|
private:
|
2012-02-04 00:11:11 +00:00
|
|
|
void addObjectFromFile(const QString & filePath);
|
2011-11-15 16:37:40 +00:00
|
|
|
void showObject(ObjWidget * obj);
|
2011-11-23 18:58:55 +00:00
|
|
|
void updateData();
|
2012-08-28 13:44:57 +00:00
|
|
|
void updateObjectSize(ObjWidget * obj);
|
2011-10-25 15:48:19 +00:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Ui_mainWindow * ui_;
|
|
|
|
|
Camera * camera_;
|
2012-08-28 13:44:57 +00:00
|
|
|
rtabmap::PdfPlotCurve * likelihoodCurve_;
|
2011-11-24 19:11:30 +00:00
|
|
|
AboutDialog * aboutDialog_;
|
2011-11-15 16:37:40 +00:00
|
|
|
QList<ObjWidget*> objects_;
|
2012-08-28 13:44:57 +00:00
|
|
|
cv::Mat objectsDescriptors_;
|
|
|
|
|
cv::flann::Index flannIndex_;
|
|
|
|
|
QMap<int, int> dataRange_; // <last id of object's descriptor, id>
|
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_;
|
2011-10-25 15:48:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif /* MainWindow_H_ */
|