Merged Audio branch to trunk

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@560 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2012-06-24 17:19:34 +00:00
parent 06fb556e78
commit 17b8e10ed8
111 changed files with 8370 additions and 9779 deletions

View File

@@ -1,2 +1 @@
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( ExamplePlot )
ADD_SUBDIRECTORY( src )

View File

@@ -1,36 +0,0 @@
ADD_DEFINITIONS(-DPLOT_WIDGET_OUT_OF_LIB)
### Qt Gui stuff ###
SET(headers_ui
../src/Plot.h
MainWindow.h
)
#This will generate moc_* for Qt
QT4_WRAP_CPP(moc_srcs ${headers_ui})
### Qt Gui stuff end###
SET(SRC_FILES
../src/Plot.cpp
main.cpp
${moc_srcs}
)
SET(INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/../src
)
INCLUDE(${QT_USE_FILE})
SET(LIBRARIES
${QT_LIBRARIES}
)
#include files
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
# create an executable file named "examplePlot" from the source files
ADD_EXECUTABLE(examplePlot ${SRC_FILES})
# Linking with Qt libraries
TARGET_LINK_LIBRARIES(examplePlot ${LIBRARIES})

View File

@@ -1,66 +0,0 @@
#ifndef MAINWINDOW_H_
#define MAINWINDOW_H_
#include <QtGui/QMainWindow>
#include <QtGui/QSlider>
#include <QtGui/QHBoxLayout>
#include <QtCore/QTimer>
#include "Plot.h"
// Note : compiled with -DPLOT_WIDGET_OUT_OF_LIB to
// remove rtabmap's namespace and UtiLite dependency of Plot.
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow() {
//Plot
Plot * plot = new Plot(this);
plot->setObjectName("Figure 1");
plot->setMaxVisibleItems(50);
plot->showRefreshRate(true);
PlotCurve * curveA = new PlotCurve("Curve A", this);
PlotCurve * curveB = new PlotCurve("Curve B", this);
curveA->setPen(QPen(Qt::red));
curveB->setPen(QPen(Qt::blue));
plot->addCurve(curveA); // ownership transferred
plot->addCurve(curveB); // ownership transferred
connect(this, SIGNAL(valueUpdatedA(float)), curveA, SLOT(addValue(float)));
connect(this, SIGNAL(valueUpdatedB(float)), curveB, SLOT(addValue(float)));
//Control
QSlider * slider = new QSlider(Qt::Vertical, this);
slider->setMinimum(1); // Hz
slider->setMaximum(100); // Hz
slider->setValue(10);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(setRate(int)));
// layout
QWidget * placeHolder = new QWidget(this);
this->setCentralWidget(placeHolder);
QHBoxLayout * hlayout = new QHBoxLayout(placeHolder);
hlayout->addWidget(plot, 1);
hlayout->addWidget(slider);
connect(&timer_, SIGNAL(timeout()), this, SLOT(updateCounter()));
setRate(slider->value());
qsrand(1);
}
~MainWindow() {}
public slots:
void updateCounter() {
emit valueUpdatedA(qrand() % 100);
emit valueUpdatedB(qrand() % 50);
}
void setRate(int rate) {
timer_.start(1000/rate);
}
signals:
void valueUpdatedA(float);
void valueUpdatedB(float);
private:
QTimer timer_;
};
#endif /* MAINWINDOW_H_ */

View File

@@ -1,12 +0,0 @@
#include <QtGui/QApplication>
#include "MainWindow.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
MainWindow mainWindow;
mainWindow.show();
app.connect( &app, SIGNAL( lastWindowClosed() ),
&app, SLOT( quit() ) );
return app.exec();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

View File

@@ -20,6 +20,8 @@
#ifndef IMAGEVIEW_H_
#define IMAGEVIEW_H_
#include "rtabmap/core/RtabmapExp.h" // DLL export/import defines
#include <QtGui/QGraphicsView>
#include <QtCore/QRectF>
@@ -28,7 +30,7 @@ class QMenu;
namespace rtabmap {
class ImageView : public QGraphicsView {
class RTABMAP_EXP ImageView : public QGraphicsView {
Q_OBJECT
@@ -42,6 +44,9 @@ public:
bool isFeaturesShown();
bool isLinesShown();
void setFeaturesShown(bool shown);
void setLinesShown(bool shown);
protected:
virtual void contextMenuEvent(QContextMenuEvent * e);
virtual void wheelEvent(QWheelEvent * e);

View File

@@ -20,6 +20,8 @@
#ifndef KEYPOINTITEM_H_
#define KEYPOINTITEM_H_
#include "rtabmap/core/RtabmapExp.h" // DLL export/import defines
#include <QtGui/QGraphicsEllipseItem>
#include <QtGui/QGraphicsTextItem>
#include <QtGui/QPen>
@@ -27,7 +29,7 @@
namespace rtabmap {
class KeypointItem : public QGraphicsEllipseItem
class RTABMAP_EXP KeypointItem : public QGraphicsEllipseItem
{
public:
KeypointItem(qreal x, qreal y, int r, const QString & info, const QColor & color = Qt::green, QGraphicsItem * parent = 0);

View File

@@ -30,6 +30,9 @@
namespace rtabmap {
class Camera;
class Micro;
class CameraMicro;
class DBReader;
}
class QGraphicsScene;
@@ -85,6 +88,7 @@ protected:
virtual void resizeEvent(QResizeEvent* anEvent);
private slots:
void beep();
void startDetection();
void pauseDetection();
void stopDetection();
@@ -95,6 +99,8 @@ private slots:
void selectImages();
void selectVideo();
void selectStream();
void selectMic();
void selectAudioFile();
void selectDatabase();
void resetTheMemory();
void dumpTheMemory();
@@ -112,6 +118,15 @@ private slots:
void changeImgRateSetting();
void changeTimeLimitSetting();
void captureScreen();
void setAspectRatio(int w, int h);
void setAspectRatio16_9();
void setAspectRatio16_10();
void setAspectRatio4_3();
void setAspectRatio240p();
void setAspectRatio360p();
void setAspectRatio480p();
void setAspectRatio720p();
void setAspectRatio1080p();
signals:
void statsReceived(const rtabmap::Statistics &);
@@ -128,13 +143,18 @@ signals:
private:
void drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords, const std::multimap<int, cv::KeyPoint> & loopWords);
void setupMainLayout(bool vertical);
void updateSelectSourceMenu(int type);
void updateSelectSourceImageMenu(int type);
void updateSelectSourceAudioMenu(int type);
void updateSelectSourceDatabase(bool used);
private:
Ui_mainWindow * _ui;
State _state;
rtabmap::Camera * _camera;
rtabmap::Micro * _mic;
rtabmap::CameraMicro * _cameraMic;
rtabmap::DBReader * _dbReader;
SrcType _srcType;
QString _srcPath;
@@ -156,8 +176,13 @@ private:
PdfPlotCurve * _posteriorCurve;
PdfPlotCurve * _likelihoodCurve;
UPlotCurve * _audioCurve;
UPlotCurve * _audioCurveLoop;
DetailedProgressDialog * _initProgressDialog;
QActionGroup * _selectSourceGrp;
QActionGroup * _selectSourceImageGrp;
QActionGroup * _selectSourceAudioGrp;
QString _graphSavingFileName;
QString _autoScreenCaptureFormat;

View File

@@ -38,11 +38,10 @@ class QMainWindow;
class QLineEdit;
class QSlider;
class QProgressDialog;
class UPlotCurve;
namespace rtabmap {
class PlotCurve;
class RTABMAP_EXP PreferencesDialog : public QDialog
{
Q_OBJECT
@@ -64,8 +63,13 @@ public:
kSrcUndef,
kSrcUsbDevice,
kSrcImages,
kSrcVideo,
kSrcDatabase
kSrcVideo
};
enum SrcAudio {
kSrcAudioUndef,
kSrcAudioMicDevice,
kSrcAudioFile
};
public:
@@ -102,13 +106,17 @@ public:
QString getWorkingDirectory();
// source panel
double getGeneralImageRate() const;
double getGeneralInputRate() const;
bool isSourceImageUsed() const;
bool isSourceAudioUsed() const;
bool isSourceDatabaseUsed() const;
bool getGeneralAutoRestart() const;
bool getGeneralCameraKeypoints() const;
int getSourceType() const;
QString getSourceTypeStr() const;
int getSourceImageType() const;
QString getSourceImageTypeStr() const;
int getSourceWidth() const;
int getSourceHeight() const;
int getFramesDropped() const;
QString getSourceImagesPath() const; //Images group
QString getSourceImagesSuffix() const; //Images group
int getSourceImagesSuffixIndex() const; //Images group
@@ -116,31 +124,44 @@ public:
bool getSourceImagesRefreshDir() const; //Images group
QString getSourceVideoPath() const; //Video group
int getSourceUsbDeviceId() const; //UsbDevice group
QString getSourceDatabasePath() const; //Database group
bool getSourceDatabaseIgnoreChildren() const; //Database group
bool getSourceDatabaseLoadActions() const; //Database group
int getSourceAudioType() const; //Audio group
QString getSourceAudioTypeStr() const; //Audio group
int getSourceMicDevice() const; //Audio group
int getSourceMicFs() const; //Audio group
int getSourceMicSampleSize() const; //Audio group
QString getSourceAudioPath() const; //Audio group
bool getSourceAudioPlayWhileRecording() const; //Audio group
QString getSourceDatabasePath() const; //Database group
//
bool isImagesKept() const;
float getTimeLimit() const;
int getMemoryType() const;
//specific
bool isStatisticsPublished() const;
double getLoopThr() const;
double getRetrievalThr() const;
double getVpThr() const;
double getExpThr() const;
//
void disableSourceAudio();
void disableGeneralCameraKeypoints();
signals:
void settingsChanged(PreferencesDialog::PANEL_FLAGS);
void settingsChanged(rtabmap::ParametersMap);
public slots:
void setInputRate(double value);
void setHardThr(int value);
void setRetrievalThr(int value);
void setImgRate(double value);
void setAutoRestart(bool value);
void setTimeLimit(float value);
void selectSource(Src src = kSrcUndef);
void selectSourceImage(Src src = kSrcUndef);
void selectSourceAudio(SrcAudio = kSrcAudioUndef);
void selectSourceDatabase(bool user = false);
private slots:
void closeDialog ( QAbstractButton * button );
@@ -160,6 +181,7 @@ private slots:
void changeDictionaryPath();
void readSettingsEnd();
void setupTreeView();
void updateBasicParameter();
protected:
virtual void showEvent ( QShowEvent * event );

View File

@@ -20,12 +20,14 @@
#ifndef QTIPL_H
#define QTIPL_H
#include "rtabmap/core/RtabmapExp.h" // DLL export/import defines
#include <QtGui/QImage>
#include <opencv2/core/core.hpp>
namespace rtabmap {
QImage Ipl2QImage(const IplImage *newImage);
QImage RTABMAP_EXP Ipl2QImage(const IplImage *newImage, int alpha = 255);
}

View File

@@ -6,8 +6,7 @@ SET(headers_ui
../include/${PROJECT_PREFIX}/gui/PreferencesDialog.h
./AboutDialog.h
./ConsoleWidget.h
./ImageView.h
./Plot.h
../include/${PROJECT_PREFIX}/gui/ImageView.h
./PdfPlot.h
./StatsToolBox.h
./DetailedProgressDialog.h
@@ -44,7 +43,6 @@ SET(SRC_FILES
./KeypointItem.cpp
./qtipl.cpp
./ImageView.cpp
./Plot.cpp
./PdfPlot.cpp
./StatsToolBox.cpp
./DetailedProgressDialog.cpp
@@ -57,6 +55,7 @@ SET(SRC_FILES
)
SET(INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/corelib/include
${CMAKE_CURRENT_SOURCE_DIR}/../include
${CMAKE_CURRENT_SOURCE_DIR}
${UTILITE_INCLUDE_DIRS}
@@ -75,27 +74,19 @@ SET(LIBRARIES
#include files
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
IF(WIN32)
IF(BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DRTABMAP_EXPORTS)
ELSE()
ADD_DEFINITIONS(-DRTABMAP_EXPORTS_STATIC)
ENDIF()
ENDIF(WIN32)
# create an executable file named "AvpdGui" from the source files
ADD_LIBRARY(guilib ${SRC_FILES})
# create a library from the source files
ADD_LIBRARY(rtabmap_guilib ${SRC_FILES})
# Linking with Qt libraries
TARGET_LINK_LIBRARIES(guilib corelib ${LIBRARIES})
TARGET_LINK_LIBRARIES(rtabmap_guilib rtabmap_corelib ${LIBRARIES})
SET_TARGET_PROPERTIES(
guilib
rtabmap_guilib
PROPERTIES
OUTPUT_NAME ${PROJECT_PREFIX}_gui
INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib
)
INSTALL(TARGETS guilib
INSTALL(TARGETS rtabmap_guilib
RUNTIME DESTINATION bin COMPONENT runtime
LIBRARY DESTINATION lib COMPONENT devel
ARCHIVE DESTINATION lib COMPONENT devel)

84
guilib/src/CameraMicro.h Normal file
View File

@@ -0,0 +1,84 @@
/*
* CameraMicro.h
*
* Created on: 2012-05-27
* Author: mathieu
*/
#ifndef CAMERAMICRO_H_
#define CAMERAMICRO_H_
#include "rtabmap/core/Camera.h"
#include "rtabmap/core/Micro.h"
#include "rtabmap/core/SensorimotorEvent.h"
#include <utilite/UThreadNode.h>
#include <utilite/UEventsManager.h>
namespace rtabmap
{
class CameraMicro : public UThreadNode
{
public:
CameraMicro(Camera * camera, Micro * micro) :
camera_(camera),
micro_(micro)
{
}
protected:
void mainLoopBegin()
{
if(!camera_ || !micro_ )
{
UERROR("Camera and/or Micro are null");
this->kill();
return;
}
micro_->startRecorder();
}
void mainLoop()
{
cv::Mat frameFreq;
// frame rate should depend on micro and camera frame rate
// (getFrame() and takeImage() are blocking calls)
cv::Mat frame = micro_->getFrame(frameFreq, true);
if(frame.empty())
{
if(this->isRunning())
{
UEventsManager::post(new MicroEvent(MicroEvent::kTypeNoMoreFrames));
this->kill();
}
return;
}
cv::Mat image = camera_->takeImage();
if(image.empty())
{
UEventsManager::post(new CameraEvent(CameraEvent::kCodeNoMoreImages));
this->kill();
return;
}
std::list<Sensor> sensors;
sensors.push_back(Sensor(image, Sensor::kTypeImage));
sensors.push_back(Sensor(frameFreq, Sensor::kTypeAudioFreqSqrdMagn));
UEventsManager::post(new SensorimotorEvent(sensors, std::list<Actuator>()));
}
void mainLoopKill()
{
if(micro_)
{
micro_->stop();
}
}
private:
Camera * camera_;
Micro * micro_;
};
}
#endif /* CAMERAMICRO_H_ */

View File

@@ -74,16 +74,16 @@ void ConsoleWidget::handleEvent(UEvent * anEvent)
{
if(logEvent->getCode() == ULogger::kFatal)
{
_timer.start(0);
QMetaObject::invokeMethod(&_timer, "start", Q_ARG(int, 0));
}
else
{
_timer.start(OLD_TIME);
QMetaObject::invokeMethod(&_timer, "start", Q_ARG(int, OLD_TIME));
}
}
else
{
_timer.start(0);
QMetaObject::invokeMethod(&_timer, "start", Q_ARG(int, 0));
}
if(logEvent->getCode() == ULogger::kFatal)

View File

@@ -17,7 +17,7 @@
* along with RTAB-Map. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ImageView.h"
#include "rtabmap/gui/ImageView.h"
#include <QtGui/QWheelEvent>
#include <QtCore/qmath.h>
@@ -26,7 +26,7 @@
#include <QtCore/QDir>
#include <QtGui/QAction>
#include "utilite/ULogger.h"
#include "KeypointItem.h"
#include "rtabmap/gui/KeypointItem.h"
namespace rtabmap {
@@ -73,11 +73,23 @@ bool ImageView::isFeaturesShown()
return _showFeatures->isChecked();
}
void ImageView::setFeaturesShown(bool shown)
{
_showFeatures->setChecked(shown);
this->updateItemsShown();
}
bool ImageView::isLinesShown()
{
return _showLines->isChecked();
}
void ImageView::setLinesShown(bool shown)
{
_showLines->setChecked(shown);
this->updateItemsShown();
}
void ImageView::contextMenuEvent(QContextMenuEvent * e)
{
QAction * action = _menu->exec(e->globalPos());

View File

@@ -17,7 +17,7 @@
* along with RTAB-Map. If not, see <http://www.gnu.org/licenses/>.
*/
#include "KeypointItem.h"
#include "rtabmap/gui/KeypointItem.h"
#include <QtGui/QPen>
#include <QtGui/QBrush>

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@
namespace rtabmap {
PdfPlotItem::PdfPlotItem(float dataX, float dataY, float width, int childCount) :
PlotItem(dataX, dataY, width),
UPlotItem(dataX, dataY, width),
_img(0),
_imagesRef(0)
{
@@ -85,7 +85,7 @@ void PdfPlotItem::showDescription(bool shown)
if(_img)
_img->setVisible(false);
}
PlotItem::showDescription(shown);
UPlotItem::showDescription(shown);
}
@@ -93,7 +93,7 @@ void PdfPlotItem::showDescription(bool shown)
PdfPlotCurve::PdfPlotCurve(const QString & name, const QMap<int, QByteArray> * imagesMapRef = 0, QObject * parent) :
PlotCurve(name, parent),
UPlotCurve(name, parent),
_imagesMapRef(imagesMapRef)
{
@@ -106,7 +106,7 @@ PdfPlotCurve::~PdfPlotCurve()
void PdfPlotCurve::clear()
{
PlotCurve::clear();
UPlotCurve::clear();
}
void PdfPlotCurve::setData(const QMap<int, float> & dataMap, const QMap<int, int> & weightsMap, int lastId)

View File

@@ -20,11 +20,11 @@
#ifndef PDFPLOT_H_
#define PDFPLOT_H_
#include "Plot.h"
#include <utilite/UPlot.h>
namespace rtabmap {
class PdfPlotItem : public PlotItem
class PdfPlotItem : public UPlotItem
{
public:
PdfPlotItem(float dataX, float dataY, float width, int childCount = -1);
@@ -47,7 +47,7 @@ private:
};
class PdfPlotCurve : public PlotCurve
class PdfPlotCurve : public UPlotCurve
{
Q_OBJECT

File diff suppressed because it is too large Load Diff

View File

@@ -1,393 +0,0 @@
/*
* Copyright (C) 2010-2011, Mathieu Labbe and IntRoLab - Universite de Sherbrooke
*
* This file is part of RTAB-Map.
*
* RTAB-Map is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RTAB-Map is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RTAB-Map. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLOT_H_
#define PLOT_H_
// Uncomment this to disable all references to RTAB-Map and UtiLite dependencies
//#define PLOT_WIDGET_OUT_OF_LIB
#include <QtGui/QFrame>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtGui/QPen>
#include <QtGui/QBrush>
#include <QtGui/QGraphicsEllipseItem>
#include <QtCore/QMutex>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtCore/QTime>
class QGraphicsView;
class QGraphicsScene;
class QGraphicsItem;
class QFormLayout;
#ifndef PLOT_WIDGET_OUT_OF_LIB
namespace rtabmap {
#endif
class PlotItem : public QGraphicsEllipseItem
{
public:
PlotItem(qreal dataX, qreal dataY, qreal width=2);
PlotItem(const QPointF & data, qreal width=2);
virtual ~PlotItem();
public:
void setNextItem(PlotItem * nextItem);
void setPreviousItem(PlotItem * previousItem);
void setData(const QPointF & data);
PlotItem * nextItem() const {return _nextItem;}
PlotItem * previousItem() const {return _previousItem;};
const QPointF & data() const {return _data;}
protected:
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent * event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent * event);
virtual void focusInEvent(QFocusEvent * event);
virtual void focusOutEvent(QFocusEvent * event);
virtual void keyReleaseEvent(QKeyEvent * keyEvent);
virtual void showDescription(bool shown);
private:
QPointF _data;
QGraphicsTextItem * _text;
PlotItem * _previousItem;
PlotItem * _nextItem;
};
class Plot;
class PlotCurve : public QObject
{
Q_OBJECT
public:
PlotCurve(const QString & name, QObject * parent = 0);
PlotCurve(const QString & name, const QVector<PlotItem *> data, QObject * parent = 0);
PlotCurve(const QString & name, const QVector<float> & x, const QVector<float> & y, QObject * parent = 0);
virtual ~PlotCurve();
const QPen & pen() const {return _pen;}
const QBrush & brush() const {return _brush;}
void setPen(const QPen & pen);
void setBrush(const QBrush & brush);
void setDefaultStepX(float stepX) {_defaultStepX = stepX;}
QString name() const {return _name;}
int itemsSize() const;
QPointF getItemData(int index);
void setStartX(float startX) {_startX = startX;}
bool isVisible() const {return _visible;}
void setData(QVector<PlotItem*> & data); // take the ownership
void setData(const QVector<float> & x, const QVector<float> & y);
void getData(QVector<float> & x, QVector<float> & y) const; // only call in Qt MainThread
void draw(QPainter * painter);
public slots:
virtual void clear();
void setVisible(bool visible);
void addValue(PlotItem * data); // take the ownership
void addValue(float y);
void addValue(float x, float y);
void addValue(const QString & y);
void addValues(QVector<PlotItem *> & data); // take the ownership
void addValues(const QVector<float> & xs, const QVector<float> & ys);
void addValues(const QVector<float> & ys);
signals:
void dataChanged(const PlotCurve *);
protected:
friend class Plot;
void attach(Plot * plot);
void detach(Plot * plot);
void updateMinMax();
const QVector<float> & getMinMax() const {return _minMax;}
int removeItem(int index);
void _addValue(PlotItem * data);;
virtual bool isMinMaxValid() const {return _minMax.size();}
virtual void update(float scaleX, float scaleY, float offsetX, float offsetY, float xDir, float yDir, bool allDataKept);
QList<QGraphicsItem *> _items;
Plot * _plot;
private:
void removeItem(PlotItem * item);
private:
QString _name;
QPen _pen;
QBrush _brush;
float _defaultStepX;
float _startX;
bool _visible;
bool _valuesShown;
QVector<float> _minMax; // minX, maxX, minY, maxY
};
class ThresholdCurve : public PlotCurve
{
Q_OBJECT
public:
ThresholdCurve(const QString & name, float thesholdValue, Qt::Orientation orientation = Qt::Horizontal, QObject * parent = 0);
virtual ~ThresholdCurve();
public slots:
void setThreshold(float threshold);
void setOrientation(Qt::Orientation orientation);
protected:
friend class Plot;
virtual void update(float scaleX, float scaleY, float offsetX, float offsetY, float xDir, float yDir, bool allDataKept);
virtual bool isMinMaxValid() const {return false;}
private:
Qt::Orientation _orientation;
};
class PlotAxis : public QWidget
{
public:
PlotAxis(Qt::Orientation orientation = Qt::Horizontal, float min=0, float max=1, QWidget * parent = 0);
virtual ~PlotAxis();
public:
void setAxis(float & min, float & max);
int border() const {return _border;}
int step() const {return _step;}
int count() const {return _count;}
void setReversed(bool reversed); // Vertical :bottom->up, horizontal :right->left
protected:
virtual void paintEvent(QPaintEvent * event);
private:
Qt::Orientation _orientation;
float _min;
float _max;
int _count;
int _step;
bool _reversed;
int _gradMaxDigits;
int _border;
};
class PlotLegendItem : public QPushButton
{
Q_OBJECT
public:
PlotLegendItem(const PlotCurve * curve, QWidget * parent = 0);
virtual ~PlotLegendItem();
const PlotCurve * curve() const {return _curve;}
signals:
void legendItemRemoved(const PlotCurve *);
protected:
virtual void contextMenuEvent(QContextMenuEvent * event);
private:
const PlotCurve * _curve;
QMenu * _menu;
QAction * _aChangeText;
QAction * _aResetText;
QAction * _aRemoveCurve;
QAction * _aCopyToClipboard;
};
class PlotLegend : public QWidget
{
Q_OBJECT
public:
PlotLegend(QWidget * parent = 0);
virtual ~PlotLegend();
void setFlat(bool on);
bool isFlat() const {return _flat;}
void addItem(const PlotCurve * curve);
QPixmap createSymbol(const QPen & pen, const QBrush & brush);
bool remove(const PlotCurve * curve);
public slots:
void removeLegendItem(const PlotCurve * curve);
signals:
void legendItemRemoved(const PlotCurve * curve);
void legendItemToggled(const PlotCurve * curve, bool toggled);
protected:
virtual void contextMenuEvent(QContextMenuEvent * event);
private slots:
void redirectToggled(bool);
private:
bool _flat;
QMenu * _menu;
QAction * _aUseFlatButtons;
};
class OrientableLabel : public QLabel
{
Q_OBJECT
public:
OrientableLabel(const QString & text, Qt::Orientation orientation = Qt::Horizontal, QWidget * parent = 0);
virtual ~OrientableLabel();
Qt::Orientation orientation() const {return _orientation;}
void setOrientation(Qt::Orientation orientation);
QSize sizeHint() const;
QSize minimumSizeHint() const;
protected:
virtual void paintEvent(QPaintEvent* event);
private:
Qt::Orientation _orientation;
};
/*
* TODO It could be cool to right-click on a dot in the
* plot to create a new plot to monitor the dot value changes.
*/
class Plot : public QWidget
{
Q_OBJECT
public:
Plot(QWidget * parent = 0);
virtual ~Plot();
PlotCurve * addCurve(const QString & curveName);
bool addCurve(PlotCurve * curves);
QStringList curveNames();
bool contains(const QString & curveName);
void removeCurves();
ThresholdCurve * addThreshold(const QString & name, float value, Qt::Orientation orientation = Qt::Horizontal);
QString title() const {return this->objectName();}
QPen getRandomPenColored();
void showLegend(bool shown);
void showGrid(bool shown);
void showRefreshRate(bool shown);
void keepAllData(bool kept);
void showXAxis(bool shown) {_horizontalAxis->setVisible(shown);}
void showYAxis(bool shown) {_verticalAxis->setVisible(shown);}
void setVariableXAxis() {_fixedAxis[0] = false;}
void setVariableYAxis() {_fixedAxis[1] = false;}
void setFixedXAxis(float x1, float x2);
void setFixedYAxis(float y1, float y2);
void setMaxVisibleItems(int maxVisibleItems);
void setTitle(const QString & text);
void setXLabel(const QString & text);
void setYLabel(const QString & text, Qt::Orientation orientation = Qt::Vertical);
void setWorkingDirectory(const QString & workingDirectory);
void setGraphicsView(bool on);
QRectF sceneRect() const;
public slots:
void removeCurve(const PlotCurve * curve);
void showCurve(const PlotCurve * curve, bool shown);
void updateAxis(); //reset axis and recompute it with all curves minMax
void clearData();
private slots:
void captureScreen();
void updateAxis(const PlotCurve * curve);
protected:
virtual void contextMenuEvent(QContextMenuEvent * event);
virtual void paintEvent(QPaintEvent * event);
virtual void resizeEvent(QResizeEvent * event);
private:
friend class PlotCurve;
void addItem(QGraphicsItem * item);
private:
void replot(QPainter * painter);
bool updateAxis(float x, float y);
bool updateAxis(float x1, float x2, float y1, float y2);
void setupUi();
void createActions();
void createMenus();
void selectScreenCaptureFormat();
private:
PlotLegend * _legend;
QGraphicsView * _view;
QGraphicsItem * _sceneRoot;
QWidget * _graphicsViewHolder;
float _axisMaximums[4]; // {x1->x2, y1->y2}
bool _axisMaximumsSet[4]; // {x1->x2, y1->y2}
bool _fixedAxis[2];
PlotAxis * _verticalAxis;
PlotAxis * _horizontalAxis;
int _penStyleCount;
int _maxVisibleItems;
QList<QGraphicsLineItem *> hGridLines;
QList<QGraphicsLineItem *> vGridLines;
QList<PlotCurve*> _curves;
QLabel * _title;
QLabel * _xLabel;
OrientableLabel * _yLabel;
QLabel * _refreshRate;
QString _workingDirectory;
QTime _refreshIntervalTime;
int _lowestRefreshRate;
QTime _refreshStartTime;
QString _autoScreenCaptureFormat;
QMenu * _menu;
QAction * _aShowLegend;
QAction * _aShowGrid;
QAction * _aKeepAllData;
QAction * _aLimit0;
QAction * _aLimit10;
QAction * _aLimit50;
QAction * _aLimit100;
QAction * _aLimit500;
QAction * _aLimit1000;
QAction * _aLimitCustom;
QAction * _aAddVerticalLine;
QAction * _aAddHorizontalLine;
QAction * _aChangeTitle;
QAction * _aChangeXLabel;
QAction * _aChangeYLabel;
QAction * _aYLabelVertical;
QAction * _aShowRefreshRate;
QAction * _aSaveFigure;
QAction * _aAutoScreenCapture;
QAction * _aClearData;
QAction * _aGraphicsView;
};
#ifndef PLOT_WIDGET_OUT_OF_LIB
}
#endif
#endif /* PLOT_H_ */

View File

@@ -26,13 +26,13 @@
#include <QtGui/QMainWindow>
#include <QtCore/QTimer>
#include <QtGui/QProgressDialog>
#include "utilite/ULogger.h"
#include "ui_preferencesDialog.h"
#include "rtabmap/core/Rtabmap.h"
#include "rtabmap/core/Parameters.h"
#include "utilite/UConversion.h"
#include "Plot.h"
#include "utilite/UStl.h"
#include <utilite/ULogger.h>
#include <utilite/UConversion.h>
#include <utilite/UPlot.h>
#include <utilite/UStl.h>
#define DEFAULT_GUI_IMAGES_KEPT true
#define DEFAULT_LOGGER_LEVEL 2
@@ -80,42 +80,64 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->horizontalSlider_keypointsOpacity, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteGeneralPanel()));
//Source panel
_ui->stackedWidget_2->setCurrentIndex(_ui->source_comboBox_type->currentIndex());
connect(_ui->source_comboBox_type, SIGNAL(currentIndexChanged(int)), _ui->stackedWidget_2, SLOT(setCurrentIndex(int)));
connect(_ui->source_comboBox_type, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->general_doubleSpinBox_imgRate, SIGNAL(valueChanged(double)), this, SLOT(makeObsoleteSourcePanel()));
//Image source
connect(_ui->groupBox_sourceImage, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
_ui->stackedWidget_image->setCurrentIndex(_ui->source_comboBox_image_type->currentIndex());
connect(_ui->source_comboBox_image_type, SIGNAL(currentIndexChanged(int)), _ui->stackedWidget_image, SLOT(setCurrentIndex(int)));
connect(_ui->source_comboBox_image_type, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->general_checkBox_autoRestart, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->general_checkBox_cameraKeypoints, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//usbDevice group
connect(_ui->source_usbDevice_spinBox_id, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_spinBox_imgWidth, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_spinBox_imgheight, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_spinBox_framesDropped, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//images group
connect(_ui->source_images_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSource()));
connect(_ui->source_images_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSourceImage()));
connect(_ui->source_images_lineEdit_path, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_images_spinBox_startPos, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_images_refreshDir, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//video group
connect(_ui->source_video_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSource()));
connect(_ui->source_video_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSourceImage()));
connect(_ui->source_video_lineEdit_path, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
//Audio source
connect(_ui->groupBox_sourceAudio, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
_ui->stackedWidget_audio->setCurrentIndex(_ui->source_comboBox_audio_type->currentIndex());
connect(_ui->source_comboBox_audio_type, SIGNAL(currentIndexChanged(int)), _ui->stackedWidget_audio, SLOT(setCurrentIndex(int)));
connect(_ui->source_comboBox_audio_type, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//audioDevice group
connect(_ui->source_audio_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSourceAudio()));
connect(_ui->source_micDevice, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_micFs, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_micSampleSize, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_audio_lineEdit_path, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_checkBox_playWhileRecording, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//database group
connect(_ui->source_database_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSource()));
connect(_ui->source_database_lineEdit_path, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_database_checkBox_loadActions, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_database_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSourceDatabase()));
connect(_ui->groupBox_sourceDatabase, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
//Rtabmap basic
connect(_ui->general_doubleSpinBox_timeThr, SIGNAL(valueChanged(double)), _ui->general_doubleSpinBox_timeThr_2, SLOT(setValue(double)));
connect(_ui->general_doubleSpinBox_hardThr, SIGNAL(valueChanged(double)), _ui->general_doubleSpinBox_hardThr_2, SLOT(setValue(double)));
connect(_ui->surf_doubleSpinBox_hessianThr, SIGNAL(valueChanged(double)), _ui->surf_doubleSpinBox_hessianThr_2, SLOT(setValue(double)));
connect(_ui->general_doubleSpinBox_similarityThr, SIGNAL(valueChanged(double)), _ui->general_doubleSpinBox_similarityThr_2, SLOT(setValue(double)));
connect(_ui->general_spinBox_imagesBufferSize, SIGNAL(valueChanged(int)), _ui->general_spinBox_imagesBufferSize_2, SLOT(setValue(int)));
connect(_ui->general_checkBox_publishStats, SIGNAL(clicked(bool)), _ui->general_checkBox_publishStats_2, SLOT(setChecked(bool)));
connect(_ui->general_spinBox_maxStMemSize, SIGNAL(valueChanged(int)), _ui->general_spinBox_maxStMemSize_2, SLOT(setValue(int)));
connect(_ui->comboBox_signatureType, SIGNAL(currentIndexChanged(int)), _ui->comboBox_signatureType_2, SLOT(setCurrentIndex(int)));
connect(_ui->lineEdit_workingDirectory, SIGNAL(textChanged(const QString &)), _ui->lineEdit_workingDirectory_2, SLOT(setText(const QString &)));
connect(_ui->general_doubleSpinBox_timeThr_2, SIGNAL(valueChanged(double)), _ui->general_doubleSpinBox_timeThr, SLOT(setValue(double)));
connect(_ui->general_doubleSpinBox_hardThr_2, SIGNAL(valueChanged(double)), _ui->general_doubleSpinBox_hardThr, SLOT(setValue(double)));
connect(_ui->surf_doubleSpinBox_hessianThr_2, SIGNAL(valueChanged(double)), _ui->surf_doubleSpinBox_hessianThr, SLOT(setValue(double)));
connect(_ui->general_spinBox_imagesBufferSize_2, SIGNAL(valueChanged(int)), _ui->general_spinBox_imagesBufferSize, SLOT(setValue(int)));
connect(_ui->general_checkBox_publishStats_2, SIGNAL(clicked(bool)), _ui->general_checkBox_publishStats, SLOT(setChecked(bool)));
connect(_ui->general_doubleSpinBox_timeThr_2, SIGNAL(editingFinished()), this, SLOT(updateBasicParameter()));
connect(_ui->general_doubleSpinBox_hardThr_2, SIGNAL(editingFinished()), this, SLOT(updateBasicParameter()));
connect(_ui->surf_doubleSpinBox_hessianThr_2, SIGNAL(editingFinished()), this, SLOT(updateBasicParameter()));
connect(_ui->general_doubleSpinBox_similarityThr_2, SIGNAL(editingFinished()), this, SLOT(updateBasicParameter()));
connect(_ui->general_spinBox_imagesBufferSize_2, SIGNAL(editingFinished()), this, SLOT(updateBasicParameter()));
connect(_ui->general_spinBox_maxStMemSize_2, SIGNAL(editingFinished()), this, SLOT(updateBasicParameter()));
connect(_ui->general_checkBox_publishStats, SIGNAL(stateChanged(int)), this, SLOT(updateBasicParameter()));
connect(_ui->general_checkBox_publishStats_2, SIGNAL(stateChanged(int)), this, SLOT(updateBasicParameter()));
connect(_ui->comboBox_signatureType_2, SIGNAL(currentIndexChanged(int)), _ui->comboBox_signatureType, SLOT(setCurrentIndex(int)));
connect(_ui->lineEdit_workingDirectory_2, SIGNAL(textChanged(const QString &)), _ui->lineEdit_workingDirectory, SLOT(setText(const QString &)));
connect(_ui->toolButton_workingDirectory_2, SIGNAL(clicked()), this, SLOT(changeWorkingDirectory()));
@@ -123,7 +145,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
//Rtabmap
_ui->general_doubleSpinBox_retrievalThr->setObjectName(Parameters::kRtabmapRetrievalThr().c_str());
_ui->general_checkBox_publishStats->setObjectName(Parameters::kRtabmapPublishStats().c_str());
_ui->general_checkBox_publishImages->setObjectName(Parameters::kRtabmapPublishImages().c_str());
_ui->general_checkBox_publishRawData->setObjectName(Parameters::kRtabmapPublishRawData().c_str());
_ui->general_checkBox_publishPdf->setObjectName(Parameters::kRtabmapPublishPdf().c_str());
_ui->general_checkBox_publishLikelihood->setObjectName(Parameters::kRtabmapPublishLikelihood().c_str());
_ui->general_doubleSpinBox_timeThr->setObjectName(Parameters::kRtabmapTimeThr().c_str());
@@ -133,6 +155,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->general_checkBox_neighborhoodSummation->setObjectName(Parameters::kRtabmapSelectionNeighborhoodSummationUsed().c_str());
_ui->general_checkBox_likelihoodUsed->setObjectName(Parameters::kRtabmapSelectionLikelihoodUsed().c_str());
_ui->general_checkBox_likelihoodStdDevRemoved->setObjectName(Parameters::kRtabmapLikelihoodStdDevRemoved().c_str());
_ui->general_checkBox_likelihoodNullValuesIgnored->setObjectName(Parameters::kRtabmapLikelihoodNullValuesIgnored().c_str());
_ui->general_checkBox_actionsSentRejectHyp->setObjectName(Parameters::kRtabmapActionsSentRejectHyp().c_str());
_ui->general_doubleSpinBox_confidenceThr->setObjectName(Parameters::kRtabmapConfidenceThr().c_str());
_ui->lineEdit_workingDirectory->setObjectName(Parameters::kRtabmapWorkingDirectory().c_str());
@@ -182,7 +205,6 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->surf_spinBox_maxLeafs->setObjectName(Parameters::kKpMaxLeafs().c_str());
_ui->surf_spinBox_wordsPerImageTarget->setObjectName(Parameters::kKpWordsPerImage().c_str());
_ui->surf_doubleSpinBox_ratioBadSign->setObjectName(Parameters::kKpBadSignRatio().c_str());
_ui->checkBox_kp_usingAdaptiveResponseThr->setObjectName(Parameters::kKpUsingAdaptiveResponseThr().c_str());
_ui->general_checkBox_reactivatedWordsComparedToNewWords->setObjectName(Parameters::kKpReactivatedWordsComparedToNewWords().c_str());
_ui->checkBox_kp_tfIdfLikelihoodUsed->setObjectName(Parameters::kKpTfIdfLikelihoodUsed().c_str());
_ui->checkBox_kp_tfIdfNormalized->setObjectName(Parameters::kKpTfIdfNormalized().c_str());
@@ -196,8 +218,8 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->surf_spinBox_octaves->setObjectName(Parameters::kSURFOctaves().c_str());
_ui->surf_spinBox_octaveLayers->setObjectName(Parameters::kSURFOctaveLayers().c_str());
_ui->checkBox_surfExtended->setObjectName(Parameters::kSURFExtended().c_str());
_ui->surf_checkBox_gpuVersion->setObjectName(Parameters::kSURFGpuVersion().c_str());
_ui->surf_checkBox_upright->setObjectName(Parameters::kSURFUpright().c_str());
_ui->surf_checkBox_gpuVersion->setObjectName(Parameters::kSURFGpuVersion().c_str());
//Star detector
_ui->star_spinBox_maxSize->setObjectName(Parameters::kStarMaxSize().c_str());
@@ -207,8 +229,11 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->star_spinBox_suppressNonmaxSize->setObjectName(Parameters::kStarSuppressNonmaxSize().c_str());
//SIFT detector
_ui->sift_doubleSpinBox_Thr->setObjectName(Parameters::kSIFTThreshold().c_str());
_ui->sift_spinBox_nFeatures->setObjectName(Parameters::kSIFTNFeatures().c_str());
_ui->sift_spinBox_nOctaveLayers->setObjectName(Parameters::kSIFTNOctaveLayers().c_str());
_ui->sift_doubleSpinBox_contrastThr->setObjectName(Parameters::kSIFTContrastThreshold().c_str());
_ui->sift_doubleSpinBox_edgeThr->setObjectName(Parameters::kSIFTEdgeThreshold().c_str());
_ui->sift_doubleSpinBox_sigma->setObjectName(Parameters::kSIFTSigma().c_str());
//FAST detector
_ui->fast_spinBox_Threshold->setObjectName(Parameters::kFASTThreshold().c_str());
@@ -221,8 +246,10 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->checkBox_publishMasks->setObjectName(Parameters::kSMPublishMasks().c_str());
_ui->checkBox_motionMaskUsed->setObjectName(Parameters::kSMMotionMaskUsed().c_str());
_ui->checkBox_logpolar->setObjectName(Parameters::kSMLogPolarUsed().c_str());
_ui->checkBox_votingScheme->setObjectName(Parameters::kSMVotingSchemeUsed().c_str());
_ui->sm_colorTable_comboBox->setObjectName(Parameters::kSMColorTable().c_str());
_ui->sm_audioDBThreshold->setObjectName(Parameters::kSMAudioDBThreshold().c_str());
_ui->checkBox_dBIndexing->setObjectName(Parameters::kSMAudioDBIndexing().c_str());
_ui->checkBox_audioMagnitudeInvariant->setObjectName(Parameters::kSMMagnitudeInvariant().c_str());
// verifyHypotheses
_ui->comboBox_vh_strategy->setObjectName(Parameters::kRtabmapVhStrategy().c_str());
@@ -438,6 +465,7 @@ void PreferencesDialog::closeDialog ( QAbstractButton * button )
break;
case QDialogButtonBox::AcceptRole:
updateBasicParameter();// make that changes without editing finished signal are updated.
if((_obsoletePanels & kPanelAll) || _parameters.size())
{
if(validateForm())
@@ -463,6 +491,7 @@ void PreferencesDialog::resetApply ( QAbstractButton * button )
switch(role)
{
case QDialogButtonBox::ApplyRole:
updateBasicParameter();// make that changes without editing finished signal are updated.
if(validateForm())
{
writeSettings();
@@ -493,20 +522,38 @@ void PreferencesDialog::resetSettings(int panelNumber)
}
else if(boxes.at(panelNumber)->objectName() == "groupBox_source0")
{
_ui->groupBox_sourceImage->setChecked(true);
_ui->general_doubleSpinBox_imgRate->setValue(1.0);
_ui->source_spinBox_imgWidth->setValue(0);
_ui->source_spinBox_imgheight->setValue(0);
_ui->source_spinBox_framesDropped->setValue(0);
_ui->general_checkBox_autoRestart->setChecked(false);
_ui->general_checkBox_cameraKeypoints->setChecked(false);
_ui->groupBox_sourceAudio->setChecked(false);
_ui->source_micDevice->setValue(0);
_ui->source_micFs->setValue(48000);
_ui->source_micSampleSize->setValue(2);
_ui->groupBox_sourceDatabase->setChecked(false);
}
else if(boxes.at(panelNumber)->objectName() == "groupBox_rtabmap_basic0")
{
_ui->general_doubleSpinBox_timeThr_2->setValue(Parameters::defaultRtabmapTimeThr());
_ui->general_doubleSpinBox_hardThr_2->setValue(Parameters::defaultRtabmapLoopThr());
_ui->surf_doubleSpinBox_hessianThr_2->setValue(Parameters::defaultSURFHessianThreshold());
_ui->general_doubleSpinBox_similarityThr_2->setValue(Parameters::defaultMemSimilarityThr());
_ui->general_spinBox_imagesBufferSize_2->setValue(Parameters::defaultRtabmapSMStateBufferSize());
_ui->general_spinBox_maxStMemSize_2->setValue(Parameters::defaultMemMaxStMemSize());
_ui->general_checkBox_publishStats_2->setChecked(Parameters::defaultRtabmapPublishStats());
_ui->lineEdit_workingDirectory_2->setText(Parameters::defaultRtabmapWorkingDirectory().c_str());
// match the advanced (spin and doubleSpin boxes)
_ui->general_doubleSpinBox_timeThr->setValue(Parameters::defaultRtabmapTimeThr());
_ui->general_doubleSpinBox_hardThr->setValue(Parameters::defaultRtabmapLoopThr());
_ui->surf_doubleSpinBox_hessianThr->setValue(Parameters::defaultSURFHessianThreshold());
_ui->general_doubleSpinBox_similarityThr->setValue(Parameters::defaultMemSimilarityThr());
_ui->general_spinBox_imagesBufferSize->setValue(Parameters::defaultRtabmapSMStateBufferSize());
_ui->general_spinBox_maxStMemSize->setValue(Parameters::defaultMemMaxStMemSize());
}
else
{
@@ -600,12 +647,14 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
QSettings settings(path, QSettings::IniFormat);
settings.beginGroup("Camera");
_ui->groupBox_sourceImage->setChecked(settings.value("imageUsed", _ui->groupBox_sourceImage->isChecked()).toBool());
_ui->general_doubleSpinBox_imgRate->setValue(settings.value("imgRate", _ui->general_doubleSpinBox_imgRate->value()).toDouble());
_ui->general_checkBox_autoRestart->setChecked(settings.value("autoRestart", _ui->general_checkBox_autoRestart->isChecked()).toBool());
_ui->general_checkBox_cameraKeypoints->setChecked(settings.value("cameraKeypoints", _ui->general_checkBox_cameraKeypoints->isChecked()).toBool());
_ui->source_comboBox_type->setCurrentIndex(settings.value("type", _ui->source_comboBox_type->currentIndex()).toInt());
_ui->source_comboBox_image_type->setCurrentIndex(settings.value("type", _ui->source_comboBox_image_type->currentIndex()).toInt());
_ui->source_spinBox_imgWidth->setValue(settings.value("imgWidth",_ui->source_spinBox_imgWidth->value()).toInt());
_ui->source_spinBox_imgheight->setValue(settings.value("imgHeight",_ui->source_spinBox_imgheight->value()).toInt());
_ui->source_spinBox_framesDropped->setValue(settings.value("framesDropped",_ui->source_spinBox_framesDropped->value()).toInt());
//usbDevice group
settings.beginGroup("usbDevice");
_ui->source_usbDevice_spinBox_id->setValue(settings.value("id",_ui->source_usbDevice_spinBox_id->value()).toInt());
@@ -620,12 +669,22 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
settings.beginGroup("video");
_ui->source_video_lineEdit_path->setText(settings.value("path", _ui->source_video_lineEdit_path->text()).toString());
settings.endGroup(); // video
//database group
settings.beginGroup("database");
_ui->source_database_lineEdit_path->setText(settings.value("path",_ui->source_database_lineEdit_path->text()).toString());
_ui->source_database_checkBox_loadActions->setChecked(settings.value("loadActions",_ui->source_database_checkBox_loadActions->isChecked()).toBool());
settings.endGroup(); // usbDevice
settings.endGroup(); // Camera
settings.beginGroup("Audio");
_ui->groupBox_sourceAudio->setChecked(settings.value("audioUsed", _ui->groupBox_sourceAudio->isChecked()).toBool());
_ui->source_comboBox_audio_type->setCurrentIndex(settings.value("type", _ui->source_comboBox_audio_type->currentIndex()).toInt());
_ui->source_micDevice->setValue(settings.value("id",_ui->source_micDevice->value()).toInt());
_ui->source_micFs->setValue(settings.value("fs",_ui->source_micFs->value()).toInt());
_ui->source_micSampleSize->setValue(settings.value("sampleSize",_ui->source_micSampleSize->value()).toInt());
_ui->source_audio_lineEdit_path->setText(settings.value("path",_ui->source_audio_lineEdit_path->text()).toString());
_ui->source_checkBox_playWhileRecording->setChecked(settings.value("playWhileRecording",_ui->source_checkBox_playWhileRecording->isChecked()).toBool());
settings.endGroup(); // Audio
settings.beginGroup("Database");
_ui->groupBox_sourceDatabase->setChecked(settings.value("databaseUsed", _ui->groupBox_sourceDatabase->isChecked()).toBool());
_ui->source_database_lineEdit_path->setText(settings.value("path",_ui->source_database_lineEdit_path->text()).toString());
settings.endGroup(); // Database
}
void PreferencesDialog::readCoreSettings(const QString & filePath)
@@ -740,13 +799,14 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath)
}
QSettings settings(path, QSettings::IniFormat);
settings.beginGroup("Camera");
settings.setValue("imageUsed", _ui->groupBox_sourceImage->isChecked());
settings.setValue("imgRate", _ui->general_doubleSpinBox_imgRate->value());
settings.setValue("autoRestart", _ui->general_checkBox_autoRestart->isChecked());
settings.setValue("cameraKeypoints", _ui->general_checkBox_cameraKeypoints->isChecked());
settings.setValue("type", _ui->source_comboBox_type->currentIndex());
settings.setValue("type", _ui->source_comboBox_image_type->currentIndex());
settings.setValue("imgWidth", _ui->source_spinBox_imgWidth->value());
settings.setValue("imgHeight", _ui->source_spinBox_imgheight->value());
settings.setValue("framesDropped", _ui->source_spinBox_framesDropped->value());
//usbDevice group
settings.beginGroup("usbDevice");
settings.setValue("id", _ui->source_usbDevice_spinBox_id->value());
@@ -761,13 +821,24 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath)
settings.beginGroup("video");
settings.setValue("path", _ui->source_video_lineEdit_path->text());
settings.endGroup(); //video
//database group
settings.beginGroup("database");
settings.setValue("path", _ui->source_database_lineEdit_path->text());
settings.setValue("loadActions", _ui->source_database_checkBox_loadActions->isChecked());
settings.endGroup(); //usbDevice
settings.endGroup(); // Camera
settings.beginGroup("Audio");
settings.setValue("audioUsed", _ui->groupBox_sourceAudio->isChecked());
settings.setValue("type", _ui->source_comboBox_audio_type->currentIndex());
settings.setValue("id", _ui->source_micDevice->value());
settings.setValue("fs", _ui->source_micFs->value());
settings.setValue("sampleSize", _ui->source_micSampleSize->value());
settings.setValue("path", _ui->source_audio_lineEdit_path->text());
settings.setValue("playWhileRecording", _ui->source_checkBox_playWhileRecording->isChecked());
settings.endGroup(); // Audio
settings.beginGroup("Database");
settings.setValue("databaseUsed", _ui->groupBox_sourceDatabase->isChecked());
settings.setValue("path", _ui->source_database_lineEdit_path->text());
settings.endGroup();
}
void PreferencesDialog::writeCoreSettings(const QString & filePath)
@@ -940,32 +1011,33 @@ QString PreferencesDialog::loadCustomConfig(const QString & section, const QStri
return value;
}
void PreferencesDialog::selectSource(Src src)
void PreferencesDialog::selectSourceImage(Src src)
{
ULOGGER_DEBUG("PreferencesDialog::selectSource()");
ULOGGER_DEBUG("");
bool fromPrefDialog = false;
//bool modified = false;
if(src == kSrcUndef)
{
fromPrefDialog = true;
if(_ui->source_comboBox_type->currentIndex() == 1)
if(_ui->source_comboBox_image_type->currentIndex() == 1)
{
src = kSrcImages;
}
else if(_ui->source_comboBox_type->currentIndex() == 2)
else if(_ui->source_comboBox_image_type->currentIndex() == 2)
{
src = kSrcVideo;
}
else if(_ui->source_comboBox_type->currentIndex() == 3)
{
src = kSrcDatabase;
}
else
{
src = kSrcUsbDevice;
}
}
else
{
// from user
_ui->groupBox_sourceImage->setChecked(true);
}
if(src == kSrcImages)
{
@@ -979,7 +1051,7 @@ void PreferencesDialog::selectSource(Src src)
QFileInfoList files = dir.entryInfoList();
if(!files.empty())
{
_ui->source_comboBox_type->setCurrentIndex(1);
_ui->source_comboBox_image_type->setCurrentIndex(1);
_ui->source_images_lineEdit_path->setText(path);
_ui->source_images_spinBox_startPos->setValue(1);
_ui->source_images_refreshDir->setChecked(false);
@@ -994,31 +1066,107 @@ void PreferencesDialog::selectSource(Src src)
}
else if(src == kSrcVideo)
{
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), _ui->source_video_lineEdit_path->text(), tr("Videos (*.avi *.mpg)"));
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), _ui->source_video_lineEdit_path->text(), tr("Videos (*.avi *.mpg *.mp4)"));
QFile file(path);
if(!path.isEmpty() && file.exists())
{
_ui->source_comboBox_type->setCurrentIndex(2);
_ui->source_comboBox_image_type->setCurrentIndex(2);
_ui->source_video_lineEdit_path->setText(path);
}
}
else if(src == kSrcDatabase)
{
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), _ui->source_database_lineEdit_path->text(), tr("Databases (*.db)"));
QFile file(path);
if(!path.isEmpty() && file.exists())
{
_ui->source_comboBox_type->setCurrentIndex(3);
_ui->source_database_lineEdit_path->setText(path);
}
}
else
{
_ui->source_comboBox_type->setCurrentIndex(0);
_ui->source_comboBox_image_type->setCurrentIndex(0);
}
if(!fromPrefDialog && _obsoletePanels)
{
_ui->groupBox_sourceDatabase->setChecked(false);
if(validateForm())
{
this->writeSettings();
}
else
{
this->readSettingsBegin();
}
}
}
void PreferencesDialog::selectSourceAudio(SrcAudio src)
{
ULOGGER_DEBUG("");
bool fromPrefDialog = false;
//bool modified = false;
if(src == kSrcAudioUndef)
{
fromPrefDialog = true;
if(_ui->source_comboBox_audio_type->currentIndex() == 1)
{
src = kSrcAudioFile;
}
else
{
src = kSrcAudioMicDevice;
}
}
else
{
// from user
_ui->groupBox_sourceAudio->setChecked(true);
}
if(src == kSrcAudioFile)
{
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), _ui->source_audio_lineEdit_path->text(), tr("Audio files (*.wav *.mp3)"));
QFile file(path);
if(!path.isEmpty() && file.exists())
{
_ui->source_comboBox_audio_type->setCurrentIndex(1);
_ui->source_audio_lineEdit_path->setText(path);
}
}
else
{
_ui->source_comboBox_audio_type->setCurrentIndex(0);
}
if(!fromPrefDialog && _obsoletePanels)
{
_ui->groupBox_sourceDatabase->setChecked(false);
if(validateForm())
{
this->writeSettings();
}
else
{
this->readSettingsBegin();
}
}
}
void PreferencesDialog::selectSourceDatabase(bool user)
{
ULOGGER_DEBUG("");
if(user)
{
// from user
_ui->groupBox_sourceDatabase->setChecked(true);
}
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), _ui->source_database_lineEdit_path->text(), tr("RTAB-Map database files (*.db)"));
QFile file(path);
if(!path.isEmpty() && file.exists())
{
_ui->source_database_lineEdit_path->setText(path);
}
if(user && _obsoletePanels)
{
_ui->groupBox_sourceImage->setChecked(false);
_ui->groupBox_sourceAudio->setChecked(false);
if(validateForm())
{
this->writeSettings();
@@ -1166,13 +1314,13 @@ void PreferencesDialog::addParameter(const QObject * object, int value)
{
if(value == 0) // 0 surf
{
this->addParameters(_ui->groupBox_descriptor_surf2);
this->addParameters(_ui->groupBox_detector_surf2);
}
else if(value == 3) // 1 sift
else if(value == 1) // 1 sift
{
// no panel
this->addParameters(_ui->groupBox_detector_sift2);
}
else if(value == 5) // 2 brief
else if(value == 2) // 2 brief
{
this->addParameters(_ui->groupBox_descriptor_brief2);
}
@@ -1284,6 +1432,55 @@ void PreferencesDialog::addParameters(const QGroupBox * box)
}
}
void PreferencesDialog::updateBasicParameter()
{
// This method is used to update basic/advanced referred parameters, see above editingFinished()
// basic to advanced (advanced to basic must be done by connecting signal valueChanged())
if(sender() == _ui->general_doubleSpinBox_timeThr_2)
{
_ui->general_doubleSpinBox_timeThr->setValue(_ui->general_doubleSpinBox_timeThr_2->value());
}
else if(sender() == _ui->general_doubleSpinBox_hardThr_2)
{
_ui->general_doubleSpinBox_hardThr->setValue(_ui->general_doubleSpinBox_hardThr_2->value());
}
else if(sender() == _ui->surf_doubleSpinBox_hessianThr_2)
{
_ui->surf_doubleSpinBox_hessianThr->setValue(_ui->surf_doubleSpinBox_hessianThr_2->value());
}
else if(sender() == _ui->general_doubleSpinBox_similarityThr_2)
{
_ui->general_doubleSpinBox_similarityThr->setValue(_ui->general_doubleSpinBox_similarityThr_2->value());
}
else if(sender() == _ui->general_spinBox_imagesBufferSize_2)
{
_ui->general_spinBox_imagesBufferSize->setValue(_ui->general_spinBox_imagesBufferSize_2->value());
}
else if(sender() == _ui->general_spinBox_maxStMemSize_2)
{
_ui->general_spinBox_maxStMemSize->setValue(_ui->general_spinBox_maxStMemSize_2->value());
}
else if(sender() == _ui->general_checkBox_publishStats)
{
_ui->general_checkBox_publishStats_2->setChecked(_ui->general_checkBox_publishStats->isChecked());
}
else if(sender() == _ui->general_checkBox_publishStats_2)
{
_ui->general_checkBox_publishStats->setChecked(_ui->general_checkBox_publishStats_2->isChecked());
}
else
{
//update all values (only those using editingFinished signal)
_ui->general_doubleSpinBox_timeThr->setValue(_ui->general_doubleSpinBox_timeThr_2->value());
_ui->general_doubleSpinBox_hardThr->setValue(_ui->general_doubleSpinBox_hardThr_2->value());
_ui->surf_doubleSpinBox_hessianThr->setValue(_ui->surf_doubleSpinBox_hessianThr_2->value());
_ui->general_doubleSpinBox_similarityThr->setValue(_ui->general_doubleSpinBox_similarityThr_2->value());
_ui->general_spinBox_imagesBufferSize->setValue(_ui->general_spinBox_imagesBufferSize_2->value());
_ui->general_spinBox_maxStMemSize->setValue(_ui->general_spinBox_maxStMemSize_2->value());
}
}
void PreferencesDialog::makeObsoleteGeneralPanel()
{
ULOGGER_DEBUG("");
@@ -1292,6 +1489,16 @@ void PreferencesDialog::makeObsoleteGeneralPanel()
void PreferencesDialog::makeObsoleteSourcePanel()
{
if(sender() == _ui->groupBox_sourceDatabase && _ui->groupBox_sourceDatabase->isChecked())
{
_ui->groupBox_sourceImage->setChecked(false);
_ui->groupBox_sourceAudio->setChecked(false);
}
else if((sender() == _ui->groupBox_sourceImage && _ui->groupBox_sourceImage->isChecked()) ||
(sender() == _ui->groupBox_sourceAudio && _ui->groupBox_sourceAudio->isChecked()))
{
_ui->groupBox_sourceDatabase->setChecked(false);
}
ULOGGER_DEBUG("");
_obsoletePanels = _obsoletePanels | kPanelSource;
}
@@ -1399,7 +1606,7 @@ void PreferencesDialog::updatePredictionPlot()
}
_ui->predictionPlot->removeCurves();
_ui->predictionPlot->addCurve(new PlotCurve("Prediction", dataX, dataY, _ui->predictionPlot));
_ui->predictionPlot->addCurve(new UPlotCurve("Prediction", dataX, dataY, _ui->predictionPlot));
}
void PreferencesDialog::setupKpRoiPanel()
@@ -1501,10 +1708,22 @@ int PreferencesDialog::getKeypointsOpacity() const
}
// Source
double PreferencesDialog::getGeneralImageRate() const
double PreferencesDialog::getGeneralInputRate() const
{
return _ui->general_doubleSpinBox_imgRate->value();
}
bool PreferencesDialog::isSourceImageUsed() const
{
return _ui->groupBox_sourceImage->isChecked();
}
bool PreferencesDialog::isSourceAudioUsed() const
{
return _ui->groupBox_sourceAudio->isChecked();
}
bool PreferencesDialog::isSourceDatabaseUsed() const
{
return _ui->groupBox_sourceDatabase->isChecked();
}
bool PreferencesDialog::getGeneralAutoRestart() const
{
return _ui->general_checkBox_autoRestart->isChecked();
@@ -1513,13 +1732,13 @@ bool PreferencesDialog::getGeneralCameraKeypoints() const
{
return _ui->general_checkBox_cameraKeypoints->isChecked();
}
int PreferencesDialog::getSourceType() const
int PreferencesDialog::getSourceImageType() const
{
return _ui->source_comboBox_type->currentIndex();
return _ui->source_comboBox_image_type->currentIndex();
}
QString PreferencesDialog::getSourceTypeStr() const
QString PreferencesDialog::getSourceImageTypeStr() const
{
return _ui->source_comboBox_type->currentText();
return _ui->source_comboBox_image_type->currentText();
}
int PreferencesDialog::getSourceWidth() const
{
@@ -1529,6 +1748,10 @@ int PreferencesDialog::getSourceHeight() const
{
return _ui->source_spinBox_imgheight->value();
}
int PreferencesDialog::getFramesDropped() const
{
return _ui->source_spinBox_framesDropped->value();
}
QString PreferencesDialog::getSourceImagesPath() const
{
return _ui->source_images_lineEdit_path->text();
@@ -1549,15 +1772,43 @@ int PreferencesDialog::getSourceUsbDeviceId() const
{
return _ui->source_usbDevice_spinBox_id->value();
}
int PreferencesDialog::getSourceAudioType() const
{
return _ui->source_comboBox_audio_type->currentIndex();
}
QString PreferencesDialog::getSourceAudioTypeStr() const
{
return _ui->source_comboBox_audio_type->currentText();
}
int PreferencesDialog::getSourceMicDevice() const
{
return _ui->source_micDevice->value();
}
int PreferencesDialog::getSourceMicFs() const
{
return _ui->source_micFs->value();
}
int PreferencesDialog::getSourceMicSampleSize() const
{
return _ui->source_micSampleSize->value();
}
QString PreferencesDialog::getSourceAudioPath() const
{
return _ui->source_audio_lineEdit_path->text();
}
bool PreferencesDialog::getSourceAudioPlayWhileRecording() const
{
return _ui->source_checkBox_playWhileRecording->isChecked();
}
QString PreferencesDialog::getSourceDatabasePath() const
{
return _ui->source_database_lineEdit_path->text();
}
bool PreferencesDialog::getSourceDatabaseLoadActions() const
{
return _ui->source_database_checkBox_loadActions->isChecked();
}
bool PreferencesDialog::isStatisticsPublished() const
{
return _ui->general_checkBox_publishStats->isChecked();
}
double PreferencesDialog::getLoopThr() const
{
return _ui->general_doubleSpinBox_hardThr->value();
@@ -1579,6 +1830,10 @@ float PreferencesDialog::getTimeLimit() const
{
return _ui->general_doubleSpinBox_timeThr->value();
}
int PreferencesDialog::getMemoryType() const
{
return _ui->comboBox_signatureType->currentIndex();
}
/*** SETTERS ***/
void PreferencesDialog::setHardThr(int value)
@@ -1617,7 +1872,7 @@ void PreferencesDialog::setRetrievalThr(int value)
}
}
void PreferencesDialog::setImgRate(double value)
void PreferencesDialog::setInputRate(double value)
{
ULOGGER_DEBUG("imgRate=%2.2f", value);
if(_ui->general_doubleSpinBox_imgRate->value() != value)
@@ -1668,4 +1923,36 @@ void PreferencesDialog::setTimeLimit(float value)
}
}
void PreferencesDialog::disableSourceAudio()
{
if(_ui->groupBox_sourceAudio->isChecked())
{
_ui->groupBox_sourceAudio->setChecked(false);
if(validateForm())
{
this->writeSettings();
}
else
{
this->readSettingsBegin();
}
}
}
void PreferencesDialog::disableGeneralCameraKeypoints()
{
if(_ui->general_checkBox_cameraKeypoints->isChecked())
{
_ui->general_checkBox_cameraKeypoints->setChecked(false);
if(validateForm())
{
this->writeSettings();
}
else
{
this->readSettingsBegin();
}
}
}
}

View File

@@ -31,8 +31,8 @@
#include <QtGui/QToolBox>
#include <QtGui/QDialog>
#include "Plot.h"
#include "utilite/ULogger.h"
#include <utilite/UPlot.h>
#include <utilite/ULogger.h>
namespace rtabmap {
@@ -54,7 +54,7 @@ StatItem::~StatItem()
void StatItem::setValue(float x, float y)
{
_value->setText(QString::number(y, 'g', 4));
_value->setText(QString::number(y, 'g', 3));
_xValue = x;
emit valueChanged(x,y);
}
@@ -247,17 +247,17 @@ void StatsToolBox::updateStat(const QString & statFullName, float x, float y)
void StatsToolBox::plot(const StatItem * stat, const QString & plotName)
{
QWidget * fig = _figures.value(plotName, (QWidget*)0);
Plot * plot = 0;
UPlot * plot = 0;
if(fig)
{
plot = fig->findChild<Plot *>(plotName);
plot = fig->findChild<UPlot *>(plotName);
}
if(plot)
{
// if not already in the plot
if(!plot->contains(stat->objectName()))
{
PlotCurve * curve = new PlotCurve(stat->objectName(), plot);
UPlotCurve * curve = new UPlotCurve(stat->objectName(), plot);
curve->setPen(plot->getRandomPenColored());
connect(stat, SIGNAL(valueChanged(float, float)), curve, SLOT(addValue(float, float)));
if(!plot->addCurve(curve))
@@ -289,7 +289,7 @@ void StatsToolBox::plot(const StatItem * stat, const QString & plotName)
figure->setAttribute(Qt::WA_DeleteOnClose, true);
connect(figure, SIGNAL(destroyed(QObject*)), this, SLOT(figureDeleted(QObject*)));
//Plot
Plot * newPlot = new Plot(figure);
UPlot * newPlot = new UPlot(figure);
newPlot->setWorkingDirectory(_workingDirectory);
newPlot->setMaxVisibleItems(50);
newPlot->setObjectName(newPlotName);
@@ -298,7 +298,7 @@ void StatsToolBox::plot(const StatItem * stat, const QString & plotName)
figure->setSizeGripEnabled(true);
//Add a new curve linked to the statBox
PlotCurve * curve = new PlotCurve(stat->objectName(), newPlot);
UPlotCurve * curve = new UPlotCurve(stat->objectName(), newPlot);
curve->setPen(newPlot->getRandomPenColored());
connect(stat, SIGNAL(valueChanged(float, float)), curve, SLOT(addValue(float, float)));
if(!newPlot->addCurve(curve))
@@ -358,7 +358,7 @@ void StatsToolBox::contextMenuEvent(QContextMenuEvent * event)
{
for(QMap<QString, QWidget*>::iterator i=_figures.begin(); i!=_figures.end(); ++i)
{
QList<Plot *> plots = i.value()->findChildren<Plot *>();
QList<UPlot *> plots = i.value()->findChildren<UPlot *>();
if(plots.size() == 1)
{
QStringList names = plots[0]->curveNames();
@@ -403,7 +403,7 @@ void StatsToolBox::getFiguresSetup(QList<int> & curvesPerFigure, QStringList & c
curveNames.clear();
for(QMap<QString, QWidget*>::iterator i=_figures.begin(); i!=_figures.end(); ++i)
{
QList<Plot *> plots = i.value()->findChildren<Plot *>();
QList<UPlot *> plots = i.value()->findChildren<UPlot *>();
if(plots.size() == 1)
{
QStringList names = plots[0]->curveNames();
@@ -449,7 +449,7 @@ void StatsToolBox::setWorkingDirectory(const QString & workingDirectory)
_workingDirectory = workingDirectory;
for(QMap<QString, QWidget*>::iterator i=_figures.begin(); i!=_figures.end(); ++i)
{
QList<Plot *> plots = i.value()->findChildren<Plot *>();
QList<UPlot *> plots = i.value()->findChildren<UPlot *>();
if(plots.size() == 1)
{
plots[0]->setWorkingDirectory(_workingDirectory);

View File

@@ -30,22 +30,26 @@ void TwistGridWidget::addTwist(float x, float y, float z, float roll, float pitc
{
if(_grid->itemAtPosition(row, col+1))
{
QLayoutItem * item = _grid->itemAtPosition(row, col+1);
if(item)
{
QWidget * w = item->widget();
if(w)
{
_grid->removeItem(item);
w->deleteLater();
}
}
TwistWidget * w = (TwistWidget*)_grid->itemAtPosition(row, col+1)->widget();
w->setData(x, y, z, roll, pitch, yaw);
this->update();
}
else
{
_grid->addWidget(new TwistWidget(x, y, z, roll, pitch, yaw, this), row, col+1);
}
_grid->addWidget(new TwistWidget(x, y, z, roll, pitch, yaw, this), row, col+1);
}
TwistWidget::TwistWidget(float x, float y, float z, float roll, float pitch, float yaw, QWidget * parent, Qt::WindowFlags f) :
QWidget(parent, f)
{
this->setData(x, y, z, roll, pitch, yaw);
this->setFixedSize(SIZE,SIZE);
this->setMinimumSize(SIZE,SIZE);
}
void TwistWidget::setData(float x, float y, float z, float roll, float pitch, float yaw)
{
if(qAbs(z) > 0.00001)
{
@@ -60,9 +64,6 @@ TwistWidget::TwistWidget(float x, float y, float z, float roll, float pitch, flo
_roll = roll;
_pitch = pitch;
_yaw = yaw;
this->setFixedSize(SIZE,SIZE);
this->setMinimumSize(SIZE,SIZE);
}
void TwistWidget::paintEvent(QPaintEvent * event)

View File

@@ -36,6 +36,8 @@ public:
TwistWidget(float x, float y, float z, float roll, float pitch, float yaw, QWidget * parent, Qt::WindowFlags f = 0);
virtual ~TwistWidget() {}
void setData(float x, float y, float z, float roll, float pitch, float yaw);
protected:
virtual void paintEvent(QPaintEvent * event);

View File

@@ -17,14 +17,14 @@
* along with RTAB-Map. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qtipl.h"
#include "rtabmap/gui/qtipl.h"
#include "utilite/ULogger.h"
#include <opencv2/core/core_c.h>
namespace rtabmap {
// TODO : support only from gray 8bits ?
QImage Ipl2QImage(const IplImage *newImage)
QImage Ipl2QImage(const IplImage *newImage, int alpha)
{
QImage qtemp;
if (newImage && newImage->depth == IPL_DEPTH_8U && cvGetSize(newImage).width>0)
@@ -33,13 +33,13 @@ QImage Ipl2QImage(const IplImage *newImage)
int y;
char* data = newImage->imageData;
qtemp= QImage(newImage->width, newImage->height,QImage::Format_RGB32 );
qtemp= QImage(newImage->width, newImage->height,QImage::Format_ARGB32 );
for( y = 0; y < newImage->height; y++, data +=newImage->widthStep )
{
for( x = 0; x < newImage->width; x++)
{
uint *p = (uint*)qtemp.scanLine (y) + x;
*p = qRgb(data[x * newImage->nChannels+2], data[x * newImage->nChannels+1],data[x * newImage->nChannels]);
*p = qRgba(data[x * newImage->nChannels+2], data[x * newImage->nChannels+1],data[x * newImage->nChannels], alpha);
}
}
}

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>842</width>
<height>457</height>
<width>1056</width>
<height>642</height>
</rect>
</property>
<property name="windowTitle">
@@ -21,7 +21,7 @@
<set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks|QMainWindow::VerticalTabs</set>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
@@ -29,100 +29,70 @@
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::Box</enum>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_refId">
<property name="minimumSize">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="rtabmap::ImageView" name="imageView_source">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
</layout>
</widget>
<item>
<widget class="QLabel" name="label_refId">
<property name="minimumSize">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="rtabmap::ImageView" name="imageView_source">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::Box</enum>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_matchId">
<property name="minimumSize">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="rtabmap::ImageView" name="imageView_loopClosure">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
</layout>
</widget>
<item>
<widget class="QLabel" name="label_matchId">
<property name="minimumSize">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="rtabmap::ImageView" name="imageView_loopClosure">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
@@ -131,8 +101,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>842</width>
<height>22</height>
<width>1056</width>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -145,6 +115,20 @@
<property name="title">
<string>Edit</string>
</property>
<widget class="QMenu" name="menuAspect_ratio">
<property name="title">
<string>Aspect ratio</string>
</property>
<addaction name="action16_9"/>
<addaction name="action16_10"/>
<addaction name="action4_3"/>
<addaction name="separator"/>
<addaction name="action1080p"/>
<addaction name="action720p"/>
<addaction name="action480p"/>
<addaction name="action360p"/>
<addaction name="action240p"/>
</widget>
<addaction name="actionApply_settings_to_the_detector"/>
<addaction name="actionClear_cache"/>
<addaction name="separator"/>
@@ -157,6 +141,7 @@
<addaction name="actionReset_the_memory"/>
<addaction name="separator"/>
<addaction name="actionAuto_screen_capture"/>
<addaction name="menuAspect_ratio"/>
</widget>
<widget class="QMenu" name="menu6">
<property name="title">
@@ -174,9 +159,23 @@
<property name="title">
<string>Select source</string>
</property>
<addaction name="actionStream"/>
<addaction name="actionImages"/>
<addaction name="actionVideo"/>
<widget class="QMenu" name="menuImage">
<property name="title">
<string>Image</string>
</property>
<addaction name="actionUsbCamera"/>
<addaction name="actionImageFiles"/>
<addaction name="actionVideo"/>
</widget>
<widget class="QMenu" name="menuAudio">
<property name="title">
<string>Audio</string>
</property>
<addaction name="actionMic"/>
<addaction name="actionAudioFile"/>
</widget>
<addaction name="menuImage"/>
<addaction name="menuAudio"/>
<addaction name="actionDatabase"/>
</widget>
<addaction name="menuSelect_source"/>
@@ -230,7 +229,7 @@
<widget class="QWidget" name="dockWidgetContents">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="rtabmap::Plot" name="posteriorPlot" native="true"/>
<widget class="UPlot" name="posteriorPlot" native="true"/>
</item>
</layout>
</widget>
@@ -491,7 +490,7 @@
<widget class="QWidget" name="dockWidgetContents_4">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="rtabmap::Plot" name="likelihoodPlot" native="true"/>
<widget class="UPlot" name="likelihoodPlot" native="true"/>
</item>
</layout>
</widget>
@@ -529,55 +528,41 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget_audioProcessedFrames">
<property name="windowTitle">
<string>Audio Processed Frames</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_9">
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="USpectrogram" name="widget_audioProcessedFrames" native="true"/>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget_audioLoopFrames">
<property name="windowTitle">
<string>Audio Loop Frames</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_10">
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="USpectrogram" name="widget_audioLoopFrames" native="true"/>
</item>
</layout>
</widget>
</widget>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
</action>
<action name="actionStream">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Usb device</string>
</property>
</action>
<action name="actionVideo">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Video...</string>
</property>
</action>
<action name="actionImages">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Images...</string>
</property>
</action>
<action name="actionSURF">
<property name="text">
<string>SURF</string>
</property>
</action>
<action name="actionFourier">
<property name="text">
<string>Fourier</string>
</property>
</action>
<action name="actionSIFT">
<property name="text">
<string>SIFT</string>
</property>
</action>
<action name="actionCenSurE">
<property name="text">
<string>CenSurE</string>
</property>
</action>
<action name="actionHelp">
<property name="enabled">
<bool>false</bool>
@@ -616,6 +601,9 @@
<property name="text">
<string>Pause</string>
</property>
<property name="toolTip">
<string>Pause</string>
</property>
</action>
<action name="actionPause_on_match">
<property name="checkable">
@@ -653,14 +641,6 @@
<string>Dump the memory</string>
</property>
</action>
<action name="actionDatabase">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Database...</string>
</property>
</action>
<action name="actionPause_when_a_loop_hypothesis_is_rejected">
<property name="checkable">
<bool>true</bool>
@@ -716,18 +696,106 @@
<string>Show working directory in file browser</string>
</property>
</action>
<action name="action16_9">
<property name="text">
<string>16:9</string>
</property>
</action>
<action name="action16_10">
<property name="text">
<string>16:10</string>
</property>
</action>
<action name="action4_3">
<property name="text">
<string>4:3</string>
</property>
</action>
<action name="action360p">
<property name="text">
<string>360p</string>
</property>
</action>
<action name="action480p">
<property name="text">
<string>480p</string>
</property>
</action>
<action name="action720p">
<property name="text">
<string>720p</string>
</property>
</action>
<action name="action1080p">
<property name="text">
<string>1080p</string>
</property>
</action>
<action name="action240p">
<property name="text">
<string>240p</string>
</property>
</action>
<action name="actionUsbCamera">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Usb camera</string>
</property>
</action>
<action name="actionImageFiles">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Images...</string>
</property>
</action>
<action name="actionVideo">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Video...</string>
</property>
</action>
<action name="actionMic">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Mic</string>
</property>
</action>
<action name="actionAudioFile">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>File...</string>
</property>
</action>
<action name="actionDatabase">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Database...</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>rtabmap::Plot</class>
<class>UPlot</class>
<extends>QWidget</extends>
<header>Plot.h</header>
<header>utilite/UPlot.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>rtabmap::ImageView</class>
<extends>QGraphicsView</extends>
<header>ImageView.h</header>
<header>../include/rtabmap/gui/ImageView.h</header>
</customwidget>
<customwidget>
<class>rtabmap::StatsToolBox</class>
@@ -747,6 +815,12 @@
<header>TwistWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>USpectrogram</class>
<extends>QWidget</extends>
<header>utilite/USpectrogram.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../GuiLib.qrc"/>

File diff suppressed because it is too large Load Diff