feat(slam): add rtabmap_ros
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_ABOUTDIALOG_H_
|
||||
#define RTABMAP_ABOUTDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtCore/QUrl>
|
||||
|
||||
class Ui_aboutDialog;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT AboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AboutDialog(QWidget * parent = 0);
|
||||
|
||||
virtual ~AboutDialog();
|
||||
|
||||
private:
|
||||
Ui_aboutDialog * _ui;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* ABOUTDIALOG_H_ */
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_CALIBRATIONDIALOG_H_
|
||||
#define RTABMAP_CALIBRATIONDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
#include <QSettings>
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
#include <rtabmap/core/CameraModel.h>
|
||||
#include <rtabmap/core/StereoCameraModel.h>
|
||||
|
||||
#include <rtabmap/utilite/UEventsHandler.h>
|
||||
|
||||
#if defined(HAVE_OPENCV_OBJDETECT) && (CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION >= 7))
|
||||
#include <opencv2/objdetect/charuco_detector.hpp>
|
||||
#define HAVE_CHARUCO
|
||||
#elif defined(HAVE_OPENCV_ARUCO)
|
||||
#include <opencv2/aruco/charuco.hpp>
|
||||
#define HAVE_CHARUCO
|
||||
#endif
|
||||
|
||||
class Ui_calibrationDialog;
|
||||
class QTextStream;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT CalibrationDialog : public QDialog, public UEventsHandler
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
CalibrationDialog(bool stereo = false, const QString & savingDirectory = ".", bool switchImages = false, QWidget * parent = 0);
|
||||
virtual ~CalibrationDialog();
|
||||
|
||||
bool isCalibrated() const {return models_[0].isValidForProjection() && (stereo_?models_[1].isValidForProjection():true);}
|
||||
const rtabmap::CameraModel & getLeftCameraModel() const {return models_[0];}
|
||||
const rtabmap::CameraModel & getRightCameraModel() const {return models_[1];}
|
||||
const rtabmap::StereoCameraModel & getStereoCameraModel() const {return stereoModel_;}
|
||||
bool isProcessing() const {return processingData_;}
|
||||
int getStereoPairs() const {return (int)stereoImagePoints_[0].size();}
|
||||
int boardWidth() const;
|
||||
int boardHeight() const;
|
||||
double squareSize() const;
|
||||
double markerLength() const;
|
||||
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
void resetSettings();
|
||||
|
||||
void setCameraName(const QString & name);
|
||||
void setProgressVisibility(bool visible);
|
||||
void setSwitchedImages(bool switched);
|
||||
void setFisheyeModel();
|
||||
void setPlumbobModel();
|
||||
void setRationalModel();
|
||||
void setStereoMode(bool stereo, const QString & leftSuffix = "left", const QString & rightSuffix = "right");
|
||||
void setSavingDirectory(const QString & savingDirectory) {savingDirectory_ = savingDirectory;}
|
||||
|
||||
StereoCameraModel stereoCalibration(const CameraModel & left, const CameraModel & right, bool ignoreStereoRectification, QTextStream * logStream = 0) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
void setBoardType(int type);
|
||||
void setBoardWidth(int width);
|
||||
void setBoardHeight(int height);
|
||||
void setSquareSize(double size);
|
||||
void setMarkerDictionary(int dictionary);
|
||||
void setMarkerLength(double length);
|
||||
void setSubpixelRefinement(bool enabled);
|
||||
void setSubpixelMaxError(double value);
|
||||
void setCalibrationDataSaved(bool enabled);
|
||||
void setExpectedStereoBaseline(double length);
|
||||
void setMaxScale(int scale);
|
||||
|
||||
void processImages(const cv::Mat & imageLeft, const cv::Mat & imageRight, const QString & cameraName);
|
||||
void generateBoard();
|
||||
void calibrate();
|
||||
void restart();
|
||||
bool save();
|
||||
|
||||
private Q_SLOTS:
|
||||
void unlock();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
virtual bool handleEvent(UEvent * event);
|
||||
|
||||
private:
|
||||
float getArea(const std::vector<cv::Point2f> & corners, const cv::Size & boardSize);
|
||||
float getSkew(const std::vector<cv::Point2f> & fourCorners);
|
||||
float getSkew(const std::vector<cv::Point2f> & corners, const cv::Size & boardSize);
|
||||
|
||||
// x -> [0, 1] (left, right)
|
||||
// y -> [0, 1] (top, bottom)
|
||||
// size -> [0, 1] (small -> big)
|
||||
// skew -> [0, 1] (low, high)
|
||||
void getParams(const std::vector<cv::Point2f> & corners, const cv::Size & boardSize, const cv::Size & imageSize,
|
||||
float & x, float & y, float & size, float & skew);
|
||||
|
||||
private:
|
||||
// parameters
|
||||
bool stereo_;
|
||||
QString leftSuffix_;
|
||||
QString rightSuffix_;
|
||||
QString savingDirectory_;
|
||||
|
||||
QString cameraName_;
|
||||
bool processingData_;
|
||||
bool savedCalibration_;
|
||||
int currentId_;
|
||||
QString timestamp_;
|
||||
|
||||
std::vector<cv::Point3f> chessboardPoints_;
|
||||
std::vector<int> chessboardPointIds_;
|
||||
#ifdef HAVE_CHARUCO
|
||||
cv::Ptr<cv::aruco::Dictionary> markerDictionary_;
|
||||
cv::Ptr<cv::aruco::DetectorParameters> arucoDetectorParams_;
|
||||
cv::Ptr<cv::aruco::CharucoBoard> charucoBoard_;
|
||||
#if CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION >= 7)
|
||||
cv::Ptr<cv::aruco::ArucoDetector> arucoDetector_;
|
||||
cv::Ptr<cv::aruco::CharucoDetector> charucoDetector_;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
std::vector<std::vector<std::vector<cv::Point2f> > > imagePoints_;
|
||||
std::vector<std::vector<std::vector<cv::Point3f> > > objectPoints_;
|
||||
std::vector<std::vector<std::vector<float> > > imageParams_;
|
||||
std::vector<std::vector<int > > imageIds_;
|
||||
std::vector<std::vector<std::vector<cv::Point2f> > > stereoImagePoints_;
|
||||
std::vector<std::vector<cv::Point3f> > stereoObjectPoints_;
|
||||
std::vector<int> stereoImageIds_;
|
||||
std::vector<cv::Size > imageSize_;
|
||||
std::vector<rtabmap::CameraModel> models_;
|
||||
rtabmap::StereoCameraModel stereoModel_;
|
||||
std::vector<unsigned short> minIrs_;
|
||||
std::vector<unsigned short> maxIrs_;
|
||||
|
||||
Ui_calibrationDialog * ui_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* CALIBRATIONDIALOG_H_ */
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_CAMERAVIEWER_H_
|
||||
#define RTABMAP_CAMERAVIEWER_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <rtabmap/utilite/UEventsHandler.h>
|
||||
#include <QDialog>
|
||||
#include <rtabmap/core/SensorData.h>
|
||||
#include <rtabmap/core/Parameters.h>
|
||||
|
||||
class QSpinBox;
|
||||
class QCheckBox;
|
||||
class QPushButton;
|
||||
class QLabel;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class ImageView;
|
||||
class CloudViewer;
|
||||
class MarkerDetector;
|
||||
|
||||
class RTABMAP_GUI_EXPORT CameraViewer : public QDialog, public UEventsHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CameraViewer(
|
||||
QWidget * parent = 0,
|
||||
const ParametersMap & parameters = ParametersMap());
|
||||
virtual ~CameraViewer();
|
||||
void setDecimation(int value);
|
||||
|
||||
public Q_SLOTS:
|
||||
void showImage(const rtabmap::SensorData & data);
|
||||
protected:
|
||||
virtual bool handleEvent(UEvent * event);
|
||||
|
||||
private:
|
||||
ImageView* imageView_;
|
||||
CloudViewer* cloudView_;
|
||||
bool processingImages_;
|
||||
QSpinBox * decimationSpin_;
|
||||
ParametersMap parameters_;
|
||||
QPushButton * pause_;
|
||||
QLabel * imageSizeLabel_;
|
||||
QCheckBox * showCloudCheckbox_;
|
||||
QCheckBox * showScanCheckbox_;
|
||||
QCheckBox * markerCheckbox_;
|
||||
MarkerDetector * markerDetector_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* CAMERAVIEWER_H_ */
|
||||
@@ -0,0 +1,501 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_CLOUDVIEWER_H_
|
||||
#define RTABMAP_CLOUDVIEWER_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include "rtabmap/core/Transform.h"
|
||||
#include "rtabmap/core/StereoCameraModel.h"
|
||||
#include "rtabmap/gui/CloudViewerInteractorStyle.h"
|
||||
#include <vtkVersionMacros.h>
|
||||
|
||||
#if VTK_MAJOR_VERSION > 8
|
||||
#ifndef slots
|
||||
#define slots Q_SLOTS
|
||||
#endif
|
||||
#include <QVTKOpenGLNativeWidget.h>
|
||||
using PCLQVTKWidget = QVTKOpenGLNativeWidget;
|
||||
#else
|
||||
#include <QVTKWidget.h>
|
||||
using PCLQVTKWidget = QVTKWidget;
|
||||
#endif
|
||||
#include <pcl/pcl_base.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/PolygonMesh.h>
|
||||
#include <pcl/TextureMesh.h>
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/qnamespace.h>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <set>
|
||||
|
||||
#include <pcl/PCLPointCloud2.h>
|
||||
|
||||
namespace pcl {
|
||||
namespace visualization {
|
||||
class PCLVisualizer;
|
||||
}
|
||||
}
|
||||
|
||||
class QMenu;
|
||||
class vtkProp;
|
||||
template <typename T> class vtkSmartPointer;
|
||||
class vtkOBBTree;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class OctoMap;
|
||||
|
||||
class RTABMAP_GUI_EXPORT CloudViewer : public PCLQVTKWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CloudViewer(QWidget * parent = 0, CloudViewerInteractorStyle* style = CloudViewerInteractorStyle::New());
|
||||
virtual ~CloudViewer();
|
||||
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
|
||||
void refreshView();
|
||||
|
||||
bool updateCloudPose(
|
||||
const std::string & id,
|
||||
const Transform & pose); //including mesh
|
||||
|
||||
bool addCloud(
|
||||
const std::string & id,
|
||||
const pcl::PCLPointCloud2Ptr & binaryCloud,
|
||||
const Transform & pose,
|
||||
bool rgb,
|
||||
bool hasNormals,
|
||||
bool hasIntensity,
|
||||
const QColor & color = QColor(),
|
||||
int viewport = 1);
|
||||
|
||||
bool addCloud(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr & cloud,
|
||||
const Transform & pose = Transform::getIdentity(),
|
||||
const QColor & color = QColor());
|
||||
|
||||
bool addCloud(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
|
||||
const Transform & pose = Transform::getIdentity(),
|
||||
const QColor & color = QColor());
|
||||
|
||||
bool addCloud(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointXYZINormal>::Ptr & cloud,
|
||||
const Transform & pose = Transform::getIdentity(),
|
||||
const QColor & color = QColor());
|
||||
|
||||
bool addCloud(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointXYZI>::Ptr & cloud,
|
||||
const Transform & pose = Transform::getIdentity(),
|
||||
const QColor & color = QColor());
|
||||
|
||||
bool addCloud(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointNormal>::Ptr & cloud,
|
||||
const Transform & pose = Transform::getIdentity(),
|
||||
const QColor & color = QColor());
|
||||
|
||||
bool addCloud(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointXYZ>::Ptr & cloud,
|
||||
const Transform & pose = Transform::getIdentity(),
|
||||
const QColor & color = QColor());
|
||||
|
||||
bool addCloudMesh(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointXYZ>::Ptr & cloud,
|
||||
const std::vector<pcl::Vertices> & polygons,
|
||||
const Transform & pose = Transform::getIdentity());
|
||||
|
||||
bool addCloudMesh(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
|
||||
const std::vector<pcl::Vertices> & polygons,
|
||||
const Transform & pose = Transform::getIdentity());
|
||||
|
||||
bool addCloudMesh(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr & cloud,
|
||||
const std::vector<pcl::Vertices> & polygons,
|
||||
const Transform & pose = Transform::getIdentity());
|
||||
|
||||
bool addCloudMesh(
|
||||
const std::string & id,
|
||||
const pcl::PolygonMesh::Ptr & mesh,
|
||||
const Transform & pose = Transform::getIdentity());
|
||||
|
||||
// Only one texture per mesh is supported!
|
||||
bool addCloudTextureMesh(
|
||||
const std::string & id,
|
||||
const pcl::TextureMesh::Ptr & textureMesh,
|
||||
const cv::Mat & texture,
|
||||
const Transform & pose = Transform::getIdentity());
|
||||
|
||||
bool addOctomap(const OctoMap * octomap, unsigned int treeDepth = 0, bool volumeRepresentation = true);
|
||||
void removeOctomap();
|
||||
|
||||
// Only one texture per mesh is supported!
|
||||
bool addTextureMesh (
|
||||
const pcl::TextureMesh &mesh,
|
||||
const cv::Mat & texture,
|
||||
const std::string &id = "texture",
|
||||
int viewport = 0);
|
||||
bool addOccupancyGridMap(
|
||||
const cv::Mat & map8U,
|
||||
float resolution, // cell size
|
||||
float xMin,
|
||||
float yMin,
|
||||
float opacity);
|
||||
void removeOccupancyGridMap();
|
||||
|
||||
bool addElevationMap(
|
||||
const cv::Mat & map32FC1,
|
||||
float resolution, // cell size
|
||||
float xMin,
|
||||
float yMin,
|
||||
float opacity);
|
||||
void removeElevationMap();
|
||||
|
||||
void updateCameraTargetPosition(
|
||||
const Transform & pose);
|
||||
|
||||
void updateCameraFrustum(
|
||||
const Transform & pose,
|
||||
const StereoCameraModel & model);
|
||||
|
||||
void updateCameraFrustum(
|
||||
const Transform & pose,
|
||||
const CameraModel & model);
|
||||
|
||||
void updateCameraFrustums(
|
||||
const Transform & pose,
|
||||
const std::vector<CameraModel> & models);
|
||||
|
||||
void updateCameraFrustums(
|
||||
const Transform & pose,
|
||||
const std::vector<StereoCameraModel> & models);
|
||||
|
||||
void addOrUpdateCoordinate(
|
||||
const std::string & id,
|
||||
const Transform & transform,
|
||||
double scale,
|
||||
bool foreground=false);
|
||||
bool updateCoordinatePose(
|
||||
const std::string & id,
|
||||
const Transform & transform);
|
||||
void removeCoordinate(const std::string & id);
|
||||
void removeAllCoordinates(const std::string & prefix = "");
|
||||
const std::set<std::string> & getAddedCoordinates() const {return _coordinates;}
|
||||
|
||||
void addOrUpdateLine(
|
||||
const std::string & id,
|
||||
const Transform & from,
|
||||
const Transform & to,
|
||||
const QColor & color,
|
||||
bool arrow = false,
|
||||
bool foreground = false);
|
||||
void removeLine(const std::string & id);
|
||||
void removeAllLines();
|
||||
const std::set<std::string> & getAddedLines() const {return _lines;}
|
||||
|
||||
void addOrUpdateSphere(
|
||||
const std::string & id,
|
||||
const Transform & pose,
|
||||
float radius,
|
||||
const QColor & color,
|
||||
bool foreground = false);
|
||||
void removeSphere(const std::string & id);
|
||||
void removeAllSpheres();
|
||||
const std::set<std::string> & getAddedSpheres() const {return _spheres;}
|
||||
|
||||
void addOrUpdateCube(
|
||||
const std::string & id,
|
||||
const Transform & pose, // center of the cube
|
||||
float width, // e.g., along x axis
|
||||
float height, // e.g., along y axis
|
||||
float depth, // e.g., along z axis
|
||||
const QColor & color,
|
||||
bool wireframe = false,
|
||||
bool foreground = false);
|
||||
void removeCube(const std::string & id);
|
||||
void removeAllCubes();
|
||||
const std::set<std::string> & getAddedCubes() const {return _cubes;}
|
||||
|
||||
void addOrUpdateQuad(
|
||||
const std::string & id,
|
||||
const Transform & pose,
|
||||
float width,
|
||||
float height,
|
||||
const QColor & color,
|
||||
bool foreground = false);
|
||||
void addOrUpdateQuad(
|
||||
const std::string & id,
|
||||
const Transform & pose,
|
||||
float widthLeft,
|
||||
float widthRight,
|
||||
float heightBottom,
|
||||
float heightTop,
|
||||
const QColor & color,
|
||||
bool foreground = false);
|
||||
void removeQuad(const std::string & id);
|
||||
void removeAllQuads();
|
||||
const std::set<std::string> & getAddedQuads() const {return _quads;}
|
||||
|
||||
void addOrUpdateFrustum(
|
||||
const std::string & id,
|
||||
const Transform & pose,
|
||||
const Transform & localTransform,
|
||||
double scale,
|
||||
const QColor & color = QColor(),
|
||||
float fovX=1.1,
|
||||
float fovY=0.85);
|
||||
bool updateFrustumPose(
|
||||
const std::string & id,
|
||||
const Transform & pose);
|
||||
void removeFrustum(const std::string & id);
|
||||
void removeAllFrustums(bool exceptCameraReference = false);
|
||||
const QMap<std::string, Transform> & getAddedFrustums() const {return _frustums;}
|
||||
|
||||
void addOrUpdateGraph(
|
||||
const std::string & id,
|
||||
const pcl::PointCloud<pcl::PointXYZ>::Ptr & graph,
|
||||
const QColor & color = Qt::gray);
|
||||
void removeGraph(const std::string & id);
|
||||
void removeAllGraphs();
|
||||
|
||||
void addOrUpdateText(
|
||||
const std::string & id,
|
||||
const std::string & text,
|
||||
const Transform & position,
|
||||
double scale,
|
||||
const QColor & color,
|
||||
bool foreground = true);
|
||||
void removeText(const std::string & id);
|
||||
void removeAllTexts();
|
||||
const std::set<std::string> & getAddedTexts() const {return _texts;}
|
||||
|
||||
bool isTrajectoryShown() const;
|
||||
unsigned int getTrajectorySize() const;
|
||||
void setTrajectoryShown(bool shown);
|
||||
void setTrajectorySize(unsigned int value);
|
||||
void clearTrajectory();
|
||||
bool isCameraAxisShown() const;
|
||||
void setCameraAxisShown(bool shown);
|
||||
double getCoordinateFrameScale() const;
|
||||
void setCoordinateFrameScale(double scale);
|
||||
bool isFrustumShown() const;
|
||||
float getFrustumScale() const;
|
||||
QColor getFrustumColor() const;
|
||||
void setFrustumShown(bool shown);
|
||||
void setFrustumScale(float value);
|
||||
void setFrustumColor(QColor value);
|
||||
void resetCamera();
|
||||
|
||||
void removeAllClouds(); //including meshes
|
||||
bool removeCloud(const std::string & id); //including mesh
|
||||
|
||||
bool getPose(const std::string & id, Transform & pose); //including meshes
|
||||
bool getCloudVisibility(const std::string & id);
|
||||
|
||||
const QMap<std::string, Transform> & getAddedClouds() const {return _addedClouds;} //including meshes
|
||||
const QColor & getDefaultBackgroundColor() const;
|
||||
const QColor & getBackgroundColor() const;
|
||||
Transform getTargetPose() const;
|
||||
std::string getIdByActor(vtkProp * actor) const;
|
||||
QColor getColor(const std::string & id);
|
||||
void setColor(const std::string & id, const QColor & color);
|
||||
|
||||
void setBackfaceCulling(bool enabled, bool frontfaceCulling);
|
||||
void setPolygonPicking(bool enabled);
|
||||
void setRenderingRate(double rate);
|
||||
void setEDLShading(bool on);
|
||||
void setLighting(bool on);
|
||||
void setShading(bool on);
|
||||
void setEdgeVisibility(bool visible);
|
||||
void setScalarVisibility(bool visible);
|
||||
void setInteractorLayer(int layer);
|
||||
|
||||
bool isBackfaceCulling() const;
|
||||
bool isFrontfaceCulling() const;
|
||||
bool isPolygonPicking() const;
|
||||
bool isEDLShadingOn() const;
|
||||
bool isLightingOn() const;
|
||||
bool isShadingOn() const;
|
||||
bool isEdgeVisible() const;
|
||||
double getRenderingRate() const;
|
||||
|
||||
void getCameraPosition(
|
||||
float & x, float & y, float & z,
|
||||
float & focalX, float & focalY, float & focalZ,
|
||||
float & upX, float & upY, float & upZ) const;
|
||||
bool isCameraTargetLocked() const;
|
||||
bool isCameraTargetFollow() const;
|
||||
bool isCameraFree() const;
|
||||
bool isCameraLockZ() const;
|
||||
bool isCameraOrtho() const;
|
||||
bool isGridShown() const;
|
||||
unsigned int getGridCellCount() const;
|
||||
float getGridCellSize() const;
|
||||
|
||||
void setCameraPosition(
|
||||
float x, float y, float z,
|
||||
float focalX, float focalY, float focalZ,
|
||||
float upX, float upY, float upZ);
|
||||
void setCameraTargetLocked(bool enabled = true);
|
||||
void setCameraTargetFollow(bool enabled = true);
|
||||
void setCameraFree();
|
||||
void setCameraLockZ(bool enabled = true);
|
||||
void setCameraOrtho(bool enabled = true);
|
||||
void setGridShown(bool shown);
|
||||
void setNormalsShown(bool shown);
|
||||
void setGridCellCount(unsigned int count);
|
||||
void setGridCellSize(float size);
|
||||
bool isNormalsShown() const;
|
||||
int getNormalsStep() const;
|
||||
float getNormalsScale() const;
|
||||
void setNormalsStep(int step);
|
||||
void setNormalsScale(float scale);
|
||||
bool isIntensityRedColormap() const;
|
||||
bool isIntensityRainbowColormap() const;
|
||||
float getIntensityMax() const;
|
||||
void setIntensityRedColormap(bool value);
|
||||
void setIntensityRainbowColormap(bool value);
|
||||
void setIntensityMax(float value);
|
||||
void buildPickingLocator(bool enable);
|
||||
const std::map<std::string, vtkSmartPointer<vtkOBBTree> > & getLocators() const {return _locators;}
|
||||
|
||||
public Q_SLOTS:
|
||||
void setDefaultBackgroundColor(const QColor & color);
|
||||
void setBackgroundColor(const QColor & color);
|
||||
void setCloudVisibility(const std::string & id, bool isVisible);
|
||||
void setCloudColorIndex(const std::string & id, int index);
|
||||
void setCloudOpacity(const std::string & id, double opacity = 1.0);
|
||||
void setCloudPointSize(const std::string & id, int size);
|
||||
virtual void clear();
|
||||
|
||||
Q_SIGNALS:
|
||||
void configChanged();
|
||||
|
||||
protected:
|
||||
virtual void keyReleaseEvent(QKeyEvent * event);
|
||||
virtual void keyPressEvent(QKeyEvent * event);
|
||||
virtual void mousePressEvent(QMouseEvent * event);
|
||||
virtual void mouseMoveEvent(QMouseEvent * event);
|
||||
virtual void wheelEvent(QWheelEvent * event);
|
||||
virtual void contextMenuEvent(QContextMenuEvent * event);
|
||||
virtual void handleAction(QAction * event);
|
||||
QMenu * menu() {return _menu;}
|
||||
pcl::visualization::PCLVisualizer * visualizer() {return _visualizer;}
|
||||
|
||||
private:
|
||||
void createMenu();
|
||||
void addGrid();
|
||||
void removeGrid();
|
||||
|
||||
private:
|
||||
pcl::visualization::PCLVisualizer * _visualizer;
|
||||
QAction * _aLockCamera;
|
||||
QAction * _aFollowCamera;
|
||||
QAction * _aResetCamera;
|
||||
QAction * _aLockViewZ;
|
||||
QAction * _aCameraOrtho;
|
||||
QAction * _aShowTrajectory;
|
||||
QAction * _aSetTrajectorySize;
|
||||
QAction * _aClearTrajectory;
|
||||
QAction * _aShowCameraAxis;
|
||||
QAction * _aSetFrameScale;
|
||||
QAction * _aShowFrustum;
|
||||
QAction * _aSetFrustumScale;
|
||||
QAction * _aSetFrustumColor;
|
||||
QAction * _aShowGrid;
|
||||
QAction * _aSetGridCellCount;
|
||||
QAction * _aSetGridCellSize;
|
||||
QAction * _aShowNormals;
|
||||
QAction * _aSetNormalsStep;
|
||||
QAction * _aSetNormalsScale;
|
||||
QAction * _aSetIntensityRedColormap;
|
||||
QAction * _aSetIntensityRainbowColormap;
|
||||
QAction * _aSetIntensityMaximum;
|
||||
QAction * _aSetBackgroundColor;
|
||||
QAction * _aSetRenderingRate;
|
||||
QAction * _aSetEDLShading;
|
||||
QAction * _aSetLighting;
|
||||
QAction * _aSetFlatShading;
|
||||
QAction * _aSetEdgeVisibility;
|
||||
QAction * _aSetScalarVisibility;
|
||||
QAction * _aBackfaceCulling;
|
||||
QAction * _aPolygonPicking;
|
||||
QMenu * _menu;
|
||||
std::set<std::string> _graphes;
|
||||
std::set<std::string> _coordinates;
|
||||
std::set<std::string> _texts;
|
||||
std::set<std::string> _lines;
|
||||
std::set<std::string> _spheres;
|
||||
std::set<std::string> _cubes;
|
||||
std::set<std::string> _quads;
|
||||
QMap<std::string, Transform> _frustums;
|
||||
pcl::PointCloud<pcl::PointXYZ>::Ptr _trajectory;
|
||||
unsigned int _maxTrajectorySize;
|
||||
float _frustumScale;
|
||||
QColor _frustumColor;
|
||||
unsigned int _gridCellCount;
|
||||
float _gridCellSize;
|
||||
int _normalsStep;
|
||||
float _normalsScale;
|
||||
bool _buildLocator;
|
||||
std::map<std::string, vtkSmartPointer<vtkOBBTree> > _locators;
|
||||
cv::Vec3d _lastCameraOrientation;
|
||||
cv::Vec3d _lastCameraPose;
|
||||
QMap<std::string, Transform> _addedClouds; // include cloud, scan, meshes
|
||||
Transform _lastPose;
|
||||
std::list<std::string> _gridLines;
|
||||
QSet<Qt::Key> _keysPressed;
|
||||
QColor _defaultBgColor;
|
||||
QColor _currentBgColor;
|
||||
bool _frontfaceCulling;
|
||||
double _renderingRate;
|
||||
vtkProp * _octomapActor;
|
||||
float _intensityAbsMax;
|
||||
double _coordinateFrameScale;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* CLOUDVIEWER_H_ */
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* CloudViewerCellPicker.h
|
||||
*
|
||||
* Created on: Aug 21, 2018
|
||||
* Author: mathieu
|
||||
*/
|
||||
|
||||
#ifndef GUILIB_SRC_CLOUDVIEWERCELLPICKER_H_
|
||||
#define GUILIB_SRC_CLOUDVIEWERCELLPICKER_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <vtkCellPicker.h>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT CloudViewerCellPicker : public vtkCellPicker {
|
||||
public:
|
||||
public:
|
||||
static CloudViewerCellPicker *New ();
|
||||
vtkTypeMacro(CloudViewerCellPicker, vtkCellPicker);
|
||||
CloudViewerCellPicker();
|
||||
virtual ~CloudViewerCellPicker();
|
||||
|
||||
protected:
|
||||
// overrided to ignore back faces
|
||||
virtual double IntersectActorWithLine(const double p1[3],
|
||||
const double p2[3],
|
||||
double t1, double t2,
|
||||
double tol,
|
||||
vtkProp3D *prop,
|
||||
vtkMapper *mapper);
|
||||
|
||||
private:
|
||||
vtkGenericCell * cell_; //used to accelerate picking
|
||||
vtkIdList * pointIds_; // used to accelerate picking
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
|
||||
#endif /* GUILIB_SRC_CLOUDVIEWERCELLPICKER_H_ */
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* CloudViewerInteractorStyl.h
|
||||
*
|
||||
* Created on: Aug 21, 2018
|
||||
* Author: mathieu
|
||||
*/
|
||||
|
||||
#ifndef GUILIB_SRC_CLOUDVIEWERINTERACTORSTYLE_H_
|
||||
#define GUILIB_SRC_CLOUDVIEWERINTERACTORSTYLE_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <pcl/visualization/mouse_event.h>
|
||||
#include <pcl/visualization/point_picking_event.h>
|
||||
#include <pcl/visualization/interactor_style.h>
|
||||
#include <pcl/point_types.h>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class CloudViewer;
|
||||
|
||||
class RTABMAP_GUI_EXPORT CloudViewerInteractorStyle: public pcl::visualization::PCLVisualizerInteractorStyle
|
||||
{
|
||||
public:
|
||||
static CloudViewerInteractorStyle *New ();
|
||||
vtkTypeMacro(CloudViewerInteractorStyle, pcl::visualization::PCLVisualizerInteractorStyle);
|
||||
|
||||
public:
|
||||
CloudViewerInteractorStyle();
|
||||
virtual void Rotate();
|
||||
void setOrthoMode(bool enabled);
|
||||
protected:
|
||||
virtual void OnMouseMove();
|
||||
virtual void OnLeftButtonDown();
|
||||
virtual void OnRightButtonDown();
|
||||
|
||||
protected:
|
||||
friend class CloudViewer;
|
||||
void setCloudViewer(CloudViewer * cloudViewer) {viewer_ = cloudViewer;}
|
||||
CloudViewer * viewer_;
|
||||
|
||||
private:
|
||||
unsigned int NumberOfClicks;
|
||||
int PreviousPosition[2];
|
||||
int ResetPixelDistance;
|
||||
float PreviousMeasure[3];
|
||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointsHolder_;
|
||||
bool orthoMode_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
|
||||
#endif /* GUILIB_SRC_CLOUDVIEWERINTERACTORSTYLE_H_ */
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_CONSOLEWIDGET_H_
|
||||
#define RTABMAP_CONSOLEWIDGET_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <rtabmap/utilite/UEventsHandler.h>
|
||||
#include <QWidget>
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QTime>
|
||||
#include <QtCore/QElapsedTimer>
|
||||
|
||||
class Ui_consoleWidget;
|
||||
class QMessageBox;
|
||||
class QTextCursor;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT ConsoleWidget : public QWidget, public UEventsHandler
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
ConsoleWidget(QWidget * parent = 0);
|
||||
virtual ~ConsoleWidget();
|
||||
|
||||
public Q_SLOTS:
|
||||
void appendMsg(const QString & msg, int level = 1);
|
||||
|
||||
Q_SIGNALS:
|
||||
void msgReceived(const QString &, int);
|
||||
|
||||
private Q_SLOTS:
|
||||
void flushConsole();
|
||||
void updateTextEditBufferSize();
|
||||
|
||||
protected:
|
||||
virtual bool handleEvent(UEvent * anEvent);
|
||||
|
||||
private:
|
||||
Ui_consoleWidget * _ui;
|
||||
QMessageBox * _errorMessage;
|
||||
QMutex _errorMessageMutex;
|
||||
QMutex _msgListMutex;
|
||||
QTimer _timer;
|
||||
QElapsedTimer _time;
|
||||
QTextCursor * _textCursor;
|
||||
QList<QPair<QString, int> > _msgList;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* CONSOLEWIDGET_H_ */
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_CREATESIMPLECALIBRATIONDIALOG_H_
|
||||
#define RTABMAP_CREATESIMPLECALIBRATIONDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
#include <QSettings>
|
||||
|
||||
class Ui_createSimpleCalibrationDialog;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT CreateSimpleCalibrationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CreateSimpleCalibrationDialog(
|
||||
const QString & savingFolder = ".",
|
||||
const QString & cameraName = "",
|
||||
QWidget * parent = 0);
|
||||
|
||||
virtual ~CreateSimpleCalibrationDialog();
|
||||
|
||||
void setCameraInfoDir(const QString & folder) {savingFolder_ = folder;}
|
||||
const QString & cameraName() const {return cameraName_;}
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateStereoView();
|
||||
void updateSaveStatus();
|
||||
void saveCalibration();
|
||||
|
||||
private:
|
||||
Ui_createSimpleCalibrationDialog * ui_;
|
||||
QString savingFolder_;
|
||||
QString cameraName_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* CREATESIMPLECALIBRATIONDIALOG_H_ */
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_DATARECORDER_H_
|
||||
#define RTABMAP_DATARECORDER_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <rtabmap/utilite/UEventsHandler.h>
|
||||
#include <QWidget>
|
||||
#include <rtabmap/core/SensorData.h>
|
||||
#include <rtabmap/utilite/UTimer.h>
|
||||
#include <rtabmap/utilite/UMutex.h>
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class Memory;
|
||||
class ImageView;
|
||||
|
||||
class RTABMAP_GUI_EXPORT DataRecorder : public QWidget, public UEventsHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataRecorder(QWidget * parent = 0);
|
||||
bool init(const QString & path, bool recordInRAM = true);
|
||||
|
||||
void closeRecorder();
|
||||
|
||||
virtual ~DataRecorder();
|
||||
|
||||
const QString & path() const {return path_;}
|
||||
|
||||
public Q_SLOTS:
|
||||
void addData(const rtabmap::SensorData & data, const Transform & pose = Transform(), const cv::Mat & infMatrix = cv::Mat::eye(6,6,CV_64FC1));
|
||||
void showImage(const cv::Mat & image, const cv::Mat & depth);
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
bool handleEvent(UEvent * event);
|
||||
|
||||
private:
|
||||
UMutex memoryMutex_;
|
||||
Memory * memory_;
|
||||
ImageView* imageView_;
|
||||
QLabel* label_;
|
||||
UTimer timer_;
|
||||
QString path_;
|
||||
bool processingImages_;
|
||||
int count_;
|
||||
int totalSizeKB_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* DATARECORDER_H_ */
|
||||
@@ -0,0 +1,264 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_DATABASEVIEWER_H_
|
||||
#define RTABMAP_DATABASEVIEWER_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtGui/QImage>
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
|
||||
#include <rtabmap/core/Link.h>
|
||||
#include <rtabmap/core/Signature.h>
|
||||
#include <rtabmap/core/GlobalMap.h>
|
||||
|
||||
class Ui_DatabaseViewer;
|
||||
class QGraphicsScene;
|
||||
class QGraphicsView;
|
||||
class QLabel;
|
||||
class QToolButton;
|
||||
class QDialog;
|
||||
class QSpinBox;
|
||||
|
||||
namespace rtabmap
|
||||
{
|
||||
class DBDriver;
|
||||
class ImageView;
|
||||
class SensorData;
|
||||
class CloudViewer;
|
||||
class OctoMap;
|
||||
class ExportCloudsDialog;
|
||||
class EditDepthArea;
|
||||
class EditMapArea;
|
||||
class LinkRefiningDialog;
|
||||
class Registration;
|
||||
class RegistrationIcp;
|
||||
|
||||
class RTABMAP_GUI_EXPORT DatabaseViewer : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DatabaseViewer(const QString & ini = QString(), QWidget * parent = 0);
|
||||
virtual ~DatabaseViewer();
|
||||
bool openDatabase(const QString & path, const ParametersMap & overridenParameters = ParametersMap());
|
||||
bool isSavedMaximized() const {return savedMaximized_;}
|
||||
void showCloseButton(bool visible = true);
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* anEvent);
|
||||
virtual void moveEvent(QMoveEvent* anEvent);
|
||||
virtual void resizeEvent(QResizeEvent* anEvent);
|
||||
virtual void keyPressEvent(QKeyEvent *event);
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
virtual bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
private Q_SLOTS:
|
||||
void writeSettings();
|
||||
void restoreDefaultSettings();
|
||||
void configModified();
|
||||
void openDatabase();
|
||||
bool closeDatabase();
|
||||
void recoverDatabase();
|
||||
void updateInfo();
|
||||
void updateStatistics();
|
||||
void selectObstacleColor();
|
||||
void selectGroundColor();
|
||||
void selectEmptyColor();
|
||||
void selectFrontierColor();
|
||||
void editDepthImage();
|
||||
void generateGraph();
|
||||
void editSaved2DMap();
|
||||
void exportSaved2DMap();
|
||||
void import2DMap();
|
||||
void regenerateSavedMap();
|
||||
void viewOptimizedMesh();
|
||||
void exportOptimizedMesh();
|
||||
void updateOptimizedMesh();
|
||||
void exportDatabase();
|
||||
void extractImages();
|
||||
void exportPosesRaw();
|
||||
void exportPosesRGBDSLAMMotionCapture();
|
||||
void exportPosesRGBDSLAM();
|
||||
void exportPosesRGBDSLAMID();
|
||||
void exportPosesKITTI();
|
||||
void exportPosesTORO();
|
||||
void exportPosesG2O();
|
||||
void exportPosesKML();
|
||||
void exportGPS_TXT();
|
||||
void exportGPS_KML();
|
||||
void generateLocalGraph();
|
||||
void regenerateLocalMaps();
|
||||
void regenerateCurrentLocalMaps();
|
||||
void view3DMap();
|
||||
void generate3DMap();
|
||||
void detectMoreLoopClosures();
|
||||
void updateAllNeighborCovariances();
|
||||
void updateAllLoopClosureCovariances();
|
||||
void updateAllLandmarkCovariances();
|
||||
void refineLinks();
|
||||
void resetAllChanges();
|
||||
void graphNodeSelected(int);
|
||||
void graphLinkSelected(int, int);
|
||||
void sliderAValueChanged(int);
|
||||
void sliderBValueChanged(int);
|
||||
void sliderAMoved(int);
|
||||
void sliderBMoved(int);
|
||||
void update3dView();
|
||||
void sliderNeighborValueChanged(int);
|
||||
void sliderLoopValueChanged(int);
|
||||
void sliderIterationsValueChanged(int);
|
||||
void editConstraint();
|
||||
void updateGrid();
|
||||
void updateOctomapView();
|
||||
void updateGraphRotation();
|
||||
void updateGraphView();
|
||||
void refineConstraint();
|
||||
void addConstraint();
|
||||
void resetConstraint();
|
||||
void rejectConstraint();
|
||||
void updateConstraintView();
|
||||
void updateLoggerLevel();
|
||||
void updateStereo();
|
||||
void notifyParametersChanged(const QStringList &);
|
||||
void setupMainLayout(bool vertical);
|
||||
void updateConstraintButtons();
|
||||
|
||||
private:
|
||||
QString getIniFilePath() const;
|
||||
void readSettings();
|
||||
|
||||
void updateIds();
|
||||
void update(int value,
|
||||
QSpinBox * spinBoxIndex,
|
||||
QLabel * labelParents,
|
||||
QLabel * labelChildren,
|
||||
QLabel * weight,
|
||||
QLabel * label,
|
||||
QLabel * stamp,
|
||||
rtabmap::ImageView * view,
|
||||
QLabel * labelId,
|
||||
QLabel * labelMapId,
|
||||
QLabel * labelPose,
|
||||
QLabel * labelOptPose,
|
||||
QLabel * labelVelocity,
|
||||
QLabel * labelCalib,
|
||||
QLabel * labelScan,
|
||||
QLabel * labelGravity,
|
||||
QLabel * labelPrior,
|
||||
QToolButton * editPriorButton,
|
||||
QToolButton * removePriorButton,
|
||||
QLabel * labelGps,
|
||||
QLabel * labelGt,
|
||||
QLabel * labelSensors,
|
||||
bool updateConstraintView);
|
||||
void updateStereo(const SensorData * data);
|
||||
void updateWordsMatching(const std::vector<int> & inliers = std::vector<int>());
|
||||
void updateConstraintView(
|
||||
const rtabmap::Link & link,
|
||||
bool updateImageSliders = true,
|
||||
const Signature & signatureFrom = Signature(0),
|
||||
const Signature & signatureTo = Signature(0));
|
||||
Link findActiveLink(int from, int to);
|
||||
bool containsLink(
|
||||
std::multimap<int, Link> & links,
|
||||
int from,
|
||||
int to);
|
||||
std::multimap<int, rtabmap::Link> updateLinksWithModifications(
|
||||
const std::multimap<int, rtabmap::Link> & edgeConstraints);
|
||||
void updateNeighborsSlider(int from = 0, int to = 0);
|
||||
void updateLoopClosuresSlider(int from = 0, int to = 0);
|
||||
void updateCovariances(const QList<Link> & links);
|
||||
void refineLinks(const QList<Link> & links);
|
||||
void refineConstraint(int from, int to, Registration * reg, RegistrationIcp * regIcp, bool silent);
|
||||
bool addConstraint(int from, int to, Registration * reg, bool silent, bool silentlyUseOptimizedGraphAsGuess = false);
|
||||
void exportPoses(int format);
|
||||
void exportGPS(int format);
|
||||
|
||||
private:
|
||||
Ui_DatabaseViewer * ui_;
|
||||
CloudViewer * constraintsViewer_;
|
||||
CloudViewer * cloudViewer_;
|
||||
CloudViewer * stereoViewer_;
|
||||
CloudViewer * occupancyGridViewer_;
|
||||
QList<int> ids_;
|
||||
std::set<int> lastWmIds_;
|
||||
std::map<int, int> mapIds_;
|
||||
std::map<int, int> weights_;
|
||||
std::map<int, std::vector<int> > wmStates_;
|
||||
QMap<int, int> idToIndex_;
|
||||
QList<rtabmap::Link> neighborLinks_;
|
||||
QList<rtabmap::Link> loopLinks_;
|
||||
int lastSliderIndexBrowsed_;
|
||||
rtabmap::DBDriver * dbDriver_;
|
||||
QString pathDatabase_;
|
||||
std::string databaseFileName_;
|
||||
std::list<std::map<int, rtabmap::Transform> > graphes_;
|
||||
std::multimap<int, rtabmap::Link> graphLinks_;
|
||||
std::map<int, rtabmap::Transform> odomPoses_;
|
||||
std::map<int, rtabmap::Transform> groundTruthPoses_;
|
||||
std::map<int, rtabmap::Transform> gpsPoses_;
|
||||
std::map<int, GPS> gpsValues_;
|
||||
std::multimap<int, rtabmap::Link> links_;
|
||||
std::multimap<int, rtabmap::Link> linksRefined_;
|
||||
std::multimap<int, rtabmap::Link> linksAdded_;
|
||||
std::multimap<int, rtabmap::Link> linksRemoved_;
|
||||
std::map<int, LaserScan> modifiedLaserScans_;
|
||||
std::vector<double> odomMaxInf_;
|
||||
LocalGridCache localMaps_;
|
||||
LocalGridCache generatedLocalMaps_;
|
||||
OctoMap * octomap_;
|
||||
ExportCloudsDialog * exportDialog_;
|
||||
QDialog * editDepthDialog_;
|
||||
EditDepthArea * editDepthArea_;
|
||||
QDialog * editMapDialog_;
|
||||
EditMapArea * editMapArea_;
|
||||
LinkRefiningDialog * linkRefiningDialog_;
|
||||
|
||||
bool savedMaximized_;
|
||||
bool firstCall_;
|
||||
QString iniFilePath_;
|
||||
|
||||
bool infoReducedGraph_;
|
||||
double infoTotalOdom_;
|
||||
double infoTotalTime_;
|
||||
int infoSessions_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* DATABASEVIEWER_H_ */
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_DEPTHCALIBRATIONDIALOG_H_
|
||||
#define RTABMAP_DEPTHCALIBRATIONDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
#include <QtCore/QSettings>
|
||||
#include <rtabmap/core/Signature.h>
|
||||
#include <rtabmap/core/Parameters.h>
|
||||
|
||||
class Ui_DepthCalibrationDialog;
|
||||
|
||||
namespace clams {
|
||||
class DiscreteDepthDistortionModel;
|
||||
}
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class ProgressDialog;
|
||||
|
||||
class RTABMAP_GUI_EXPORT DepthCalibrationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DepthCalibrationDialog(QWidget * parent = 0);
|
||||
virtual ~DepthCalibrationDialog();
|
||||
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
|
||||
void calibrate(const std::map<int, Transform> & poses,
|
||||
const QMap<int, Signature> & cachedSignatures,
|
||||
const QString & workingDirectory,
|
||||
const ParametersMap & parameters);
|
||||
|
||||
Q_SIGNALS:
|
||||
void configChanged();
|
||||
|
||||
public Q_SLOTS:
|
||||
void restoreDefaults();
|
||||
|
||||
private Q_SLOTS:
|
||||
void saveModel();
|
||||
void cancel();
|
||||
|
||||
private:
|
||||
Ui_DepthCalibrationDialog * _ui;
|
||||
ProgressDialog * _progressDialog;
|
||||
bool _canceled;
|
||||
clams::DiscreteDepthDistortionModel * _model;
|
||||
QString _workingDirectory;
|
||||
cv::Size _imageSize;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
|
||||
#endif /* GUILIB_SRC_DEPTHCALIBRATIONDIALOG_H_ */
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright (c) 2010-2019, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_EDITCONSTRAINTDIALOG_H_
|
||||
#define RTABMAP_EDITCONSTRAINTDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
#include <rtabmap/core/Transform.h>
|
||||
|
||||
class Ui_EditConstraintDialog;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT EditConstraintDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditConstraintDialog(const Transform & constraint, const cv::Mat & covariance = cv::Mat::eye(6,6,CV_64FC1), QWidget * parent = 0);
|
||||
|
||||
void setPoseGroupVisible(bool visible);
|
||||
void setCovarianceGroupVisible(bool visible);
|
||||
|
||||
virtual ~EditConstraintDialog();
|
||||
Transform getTransform() const;
|
||||
cv::Mat getCovariance() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void switchUnits();
|
||||
|
||||
private:
|
||||
Ui_EditConstraintDialog * _ui;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* EDITCONSTRAINTDIALOG_H_ */
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_EDITDEPTHAREA_H
|
||||
#define RTABMAP_EDITDEPTHAREA_H
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QColor>
|
||||
#include <QImage>
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include "rtabmap/utilite/UCv2Qt.h"
|
||||
|
||||
class QMenu;
|
||||
class QAction;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT EditDepthArea : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditDepthArea(QWidget *parent = 0);
|
||||
|
||||
void setImage(const cv::Mat & depth, const cv::Mat & rgb = cv::Mat());
|
||||
cv::Mat getModifiedImage() const;
|
||||
bool isModified() const {return modified_;}
|
||||
|
||||
void setPenWidth(int newWidth);
|
||||
int penWidth() const { return myPenWidth_; }
|
||||
void setClusterError(double error) { clusterError_ = error; }
|
||||
double clusterError() const { return clusterError_; }
|
||||
void setColorMap(uCvQtDepthColorMap type);
|
||||
|
||||
public Q_SLOTS:
|
||||
void resetChanges();
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event);
|
||||
virtual void mouseMoveEvent(QMouseEvent *event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event);
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
virtual void contextMenuEvent(QContextMenuEvent * e);
|
||||
|
||||
private:
|
||||
void drawLineTo(const QPoint &endPoint);
|
||||
void computeScaleOffsets(const QRect & targetRect, float & scale, float & offsetX, float & offsetY) const;
|
||||
|
||||
bool modified_;
|
||||
bool scribbling_;
|
||||
int myPenWidth_;
|
||||
double clusterError_;
|
||||
QImage imageRGB_;
|
||||
QImage image_;
|
||||
cv::Mat originalImage_;
|
||||
QPoint lastPoint_;
|
||||
|
||||
QMenu * menu_;
|
||||
QAction * showRGB_;
|
||||
QAction * removeCluster_;
|
||||
QAction * clusterErrorCluster_;
|
||||
QAction * resetChanges_;
|
||||
QAction * setPenWidth_;
|
||||
QAction * colorMapWhiteToBlack_;
|
||||
QAction * colorMapBlackToWhite_;
|
||||
QAction * colorMapRedToBlue_;
|
||||
QAction * colorMapBlueToRed_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_EDITMAPAREA_H
|
||||
#define RTABMAP_EDITMAPAREA_H
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QColor>
|
||||
#include <QImage>
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include "rtabmap/utilite/UCv2Qt.h"
|
||||
|
||||
class QMenu;
|
||||
class QAction;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT EditMapArea : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditMapArea(QWidget *parent = 0);
|
||||
|
||||
void setMap(const cv::Mat & map);
|
||||
cv::Mat getModifiedMap() const;
|
||||
bool isModified() const {return modified_;}
|
||||
|
||||
void setPenWidth(int newWidth);
|
||||
int penWidth() const { return myPenWidth_; }
|
||||
void setColorMap(uCvQtDepthColorMap type);
|
||||
|
||||
public Q_SLOTS:
|
||||
void resetChanges();
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event);
|
||||
virtual void mouseMoveEvent(QMouseEvent *event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event);
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
virtual void contextMenuEvent(QContextMenuEvent * e);
|
||||
|
||||
private:
|
||||
void drawLineTo(const QPoint &endPoint);
|
||||
void computeScaleOffsets(const QRect & targetRect, float & scale, float & offsetX, float & offsetY) const;
|
||||
|
||||
bool modified_;
|
||||
bool scribbling_;
|
||||
int myPenWidth_;
|
||||
QImage map_;
|
||||
cv::Mat originalMap_;
|
||||
QPoint lastPoint_;
|
||||
|
||||
QMenu * menu_;
|
||||
QAction * resetChanges_;
|
||||
QAction * setPenWidth_;
|
||||
QAction * addObstacle_;
|
||||
QAction * clearObstacle_;
|
||||
QAction * setUnknown_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_CORE_EXPORTBUNDLERDIALOG_H_
|
||||
#define RTABMAP_CORE_EXPORTBUNDLERDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <rtabmap/core/Signature.h>
|
||||
#include <rtabmap/core/Parameters.h>
|
||||
#include <QDialog>
|
||||
#include <QSettings>
|
||||
|
||||
class Ui_ExportBundlerDialog;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT ExportBundlerDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExportBundlerDialog(QWidget * parent = 0);
|
||||
|
||||
virtual ~ExportBundlerDialog();
|
||||
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
|
||||
void setWorkingDirectory(const QString & path);
|
||||
|
||||
void exportBundler(
|
||||
std::map<int, Transform> & poses,
|
||||
const std::multimap<int, Link> & links,
|
||||
const QMap<int, Signature> & signatures,
|
||||
const ParametersMap & parameters);
|
||||
|
||||
Q_SIGNALS:
|
||||
void configChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void getPath();
|
||||
void restoreDefaults();
|
||||
void updateVisibility();
|
||||
|
||||
private:
|
||||
Ui_ExportBundlerDialog * _ui;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* EXPORTBUNDLERDIALOG_H_ */
|
||||
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_CORE_EXPORTCLOUDSDIALOG_H_
|
||||
#define RTABMAP_CORE_EXPORTCLOUDSDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <rtabmap/core/Signature.h>
|
||||
#include <rtabmap/core/Parameters.h>
|
||||
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/PolygonMesh.h>
|
||||
#include <pcl/TextureMesh.h>
|
||||
#include <pcl/pcl_base.h>
|
||||
|
||||
class Ui_ExportCloudsDialog;
|
||||
class QAbstractButton;
|
||||
|
||||
namespace rtabmap {
|
||||
class ProgressDialog;
|
||||
class GainCompensator;
|
||||
class DBDriver;
|
||||
|
||||
class RTABMAP_GUI_EXPORT ExportCloudsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExportCloudsDialog(QWidget *parent = 0);
|
||||
|
||||
virtual ~ExportCloudsDialog();
|
||||
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
|
||||
void setDBDriver(const DBDriver * dbDriver) {_dbDriver = dbDriver;}
|
||||
void forceAssembling(bool enabled);
|
||||
void setProgressDialogToMax();
|
||||
void setSaveButton();
|
||||
void setOkButton();
|
||||
|
||||
void exportClouds(
|
||||
const std::map<int, Transform> & poses,
|
||||
const std::multimap<int, Link> & links,
|
||||
const std::map<int, int> & mapIds,
|
||||
const QMap<int, Signature> & cachedSignatures,
|
||||
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
|
||||
const std::map<int, LaserScan> & cachedScans,
|
||||
const QString & workingDirectory,
|
||||
const ParametersMap & parameters);
|
||||
|
||||
void viewClouds(
|
||||
const std::map<int, Transform> & poses,
|
||||
const std::multimap<int, Link> & links,
|
||||
const std::map<int, int> & mapIds,
|
||||
const QMap<int, Signature> & cachedSignatures,
|
||||
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
|
||||
const std::map<int, LaserScan> & cachedScans,
|
||||
const QString & workingDirectory,
|
||||
const ParametersMap & parameters);
|
||||
|
||||
bool getExportedClouds(
|
||||
const std::map<int, Transform> & poses,
|
||||
const std::multimap<int, Link> & links,
|
||||
const std::map<int, int> & mapIds,
|
||||
const QMap<int, Signature> & cachedSignatures,
|
||||
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
|
||||
const std::map<int, LaserScan> & cachedScans,
|
||||
const QString & workingDirectory,
|
||||
const ParametersMap & parameters,
|
||||
std::map<int, pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr> & clouds,
|
||||
std::map<int, pcl::PolygonMesh::Ptr> & meshes,
|
||||
std::map<int, pcl::TextureMesh::Ptr> & textureMeshes,
|
||||
std::vector<std::map<int, pcl::PointXY> > & textureVertexToPixels);
|
||||
|
||||
int getTextureSize() const;
|
||||
int getMaxTextures() const;
|
||||
bool isGainCompensation() const;
|
||||
double getGainBeta() const;
|
||||
bool isGainRGB() const;
|
||||
bool isBlending() const;
|
||||
int getBlendingDecimation() const;
|
||||
int getTextureBrightnessConstrastRatioLow() const;
|
||||
int getTextureBrightnessConstrastRatioHigh() const;
|
||||
bool isExposeFusion() const;
|
||||
|
||||
static bool removeDirRecursively(const QString & dirName);
|
||||
|
||||
Q_SIGNALS:
|
||||
void configChanged();
|
||||
|
||||
public Q_SLOTS:
|
||||
void restoreDefaults();
|
||||
|
||||
private Q_SLOTS:
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
void updateReconstructionFlavor();
|
||||
void selectDistortionModel();
|
||||
void selectCamProjMask();
|
||||
void updateMLSGrpVisibility();
|
||||
void cancel();
|
||||
|
||||
private:
|
||||
std::map<int, Transform> filterNodes(const std::map<int, Transform> & poses);
|
||||
std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::IndicesPtr> > getClouds(
|
||||
const std::map<int, Transform> & poses,
|
||||
const QMap<int, Signature> & cachedSignatures,
|
||||
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
|
||||
const std::map<int, LaserScan> & cachedScans,
|
||||
const ParametersMap & parameters,
|
||||
bool & has2dScans,
|
||||
bool & scansHaveRGB) const;
|
||||
void saveClouds(const QString & workingDirectory, const std::map<int, Transform> & poses, const std::map<int, pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr> & clouds, bool binaryMode = true, const std::vector<std::map<int, pcl::PointXY> > & pointToPixels = std::vector<std::map<int, pcl::PointXY> >());
|
||||
void saveMeshes(const QString & workingDirectory, const std::map<int, Transform> & poses, const std::map<int, pcl::PolygonMesh::Ptr> & meshes, bool binaryMode = true);
|
||||
void saveTextureMeshes(const QString & workingDirectory, const std::map<int, Transform> & poses, std::map<int, pcl::TextureMesh::Ptr> & textureMeshes, const QMap<int, Signature> & cachedSignatures, const std::vector<std::map<int, pcl::PointXY> > & textureVertexToPixels);
|
||||
|
||||
private:
|
||||
Ui_ExportCloudsDialog * _ui;
|
||||
ProgressDialog * _progressDialog;
|
||||
QString _workingDirectory;
|
||||
bool _canceled;
|
||||
GainCompensator * _compensator;
|
||||
const DBDriver * _dbDriver;
|
||||
bool _scansHaveRGB;
|
||||
|
||||
bool saveOBJFile(const QString &path, pcl::TextureMesh::Ptr &mesh) const;
|
||||
bool saveOBJFile(const QString &path, pcl::PolygonMesh &mesh) const;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* EXPORTCLOUDSDIALOG_H_ */
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_CORE_EXPORTDIALOG_H_
|
||||
#define RTABMAP_CORE_EXPORTDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
#include <QSettings>
|
||||
|
||||
class Ui_ExportDialog;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT ExportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExportDialog(QWidget * parent = 0);
|
||||
|
||||
virtual ~ExportDialog();
|
||||
|
||||
void saveSettings(QSettings & settings, const QString & group) const;
|
||||
void loadSettings(QSettings & settings, const QString & group);
|
||||
|
||||
QString outputPath() const;
|
||||
int framesIgnored() const;
|
||||
double targetFramerate() const;
|
||||
int sessionExported() const;
|
||||
bool isRgbExported() const;
|
||||
bool isDepthExported() const;
|
||||
bool isDepth2dExported() const;
|
||||
bool isOdomExported() const;
|
||||
bool isUserDataExported() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void configChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void getPath();
|
||||
void restoreDefaults();
|
||||
|
||||
private:
|
||||
Ui_ExportDialog * _ui;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* EXPORTDIALOG_H_ */
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_GRAPHVIEWER_H_
|
||||
#define RTABMAP_GRAPHVIEWER_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QSettings>
|
||||
#include <rtabmap/core/Link.h>
|
||||
#include <rtabmap/core/GPS.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
class QGraphicsItem;
|
||||
class QGraphicsPixmapItem;
|
||||
class QGraphicsItemGroup;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class NodeItem;
|
||||
class LinkItem;
|
||||
|
||||
class RTABMAP_GUI_EXPORT GraphViewer : public QGraphicsView {
|
||||
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
enum ViewPlane {XY, XZ, YZ};
|
||||
|
||||
public:
|
||||
GraphViewer(QWidget * parent = 0);
|
||||
virtual ~GraphViewer();
|
||||
|
||||
void setWorldMapRotation(const float & theta);
|
||||
float getWorldMapRotation() const {return _worldMapRotation;}
|
||||
|
||||
void updateGraph(const std::map<int, Transform> & poses,
|
||||
const std::multimap<int, Link> & constraints,
|
||||
const std::map<int, int> & mapIds,
|
||||
const std::map<int, int> & weights = std::map<int, int>(),
|
||||
const std::set<int> & odomCacheIds = std::set<int>());
|
||||
void updateGTGraph(const std::map<int, Transform> & poses);
|
||||
void updateGPSGraph(
|
||||
const std::map<int, Transform> & gpsMapPoses,
|
||||
const std::map<int, GPS> & gpsValues);
|
||||
void updateReferentialPosition(const Transform & t);
|
||||
void updateMap(const cv::Mat & map8U, float resolution, float xMin, float yMin);
|
||||
// Use updateNodeColorByValue() instead with valueName="Posterior".
|
||||
RTABMAP_DEPRECATED void updatePosterior(const std::map<int, float> & posterior, float fixedMax = 0.0f, int zValueOffset = 0);
|
||||
void updateNodeColorByValue(const std::string & valueName, const std::map<int, float> & values, float fixedMax = 0.0f, bool invertedColorScale = false, int zValueOffset = 0);
|
||||
void updateLocalPath(const std::vector<int> & localPath);
|
||||
void setGlobalPath(const std::vector<std::pair<int, Transform> > & globalPath);
|
||||
void setCurrentGoalID(int id, const Transform & pose = Transform());
|
||||
void setNodeInfo(int id, const QString & info);
|
||||
void setLocalRadius(float radius);
|
||||
void highlightNode(int nodeId, int highlightIndex);
|
||||
void clearGraph();
|
||||
void clearMap();
|
||||
// Use clearNodeColorByValue() instead.
|
||||
RTABMAP_DEPRECATED void clearPosterior();
|
||||
void clearNodeColorByValue();
|
||||
void clearAll();
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
|
||||
//getters
|
||||
const QString & getWorkingDirectory() const {return _workingDirectory;}
|
||||
float getNodeRadius() const {return _nodeRadius;}
|
||||
float getLinkWidth() const {return _linkWidth;}
|
||||
const QColor & getNodeColor() const {return _nodeColor;}
|
||||
const QColor & getNodeOdomCacheColor() const {return _nodeOdomCacheColor;}
|
||||
const QColor & getCurrentGoalColor() const {return _currentGoalColor;}
|
||||
const QColor & getNeighborColor() const {return _neighborColor;}
|
||||
const QColor & getGlobalLoopClosureColor() const {return _loopClosureColor;}
|
||||
const QColor & getLocalLoopClosureColor() const {return _loopClosureLocalColor;}
|
||||
const QColor & getUserLoopClosureColor() const {return _loopClosureUserColor;}
|
||||
const QColor & getVirtualLoopClosureColor() const {return _loopClosureVirtualColor;}
|
||||
const QColor & getNeighborMergedColor() const {return _neighborMergedColor;}
|
||||
const QColor & getRejectedLoopClosureColor() const {return _loopClosureRejectedColor;}
|
||||
const QColor & getLocalPathColor() const {return _localPathColor;}
|
||||
const QColor & getGlobalPathColor() const {return _globalPathColor;}
|
||||
const QColor & getGTColor() const {return _gtPathColor;}
|
||||
const QColor & getGPSColor() const {return _gpsPathColor;}
|
||||
const QColor & getIntraSessionLoopColor() const {return _loopIntraSessionColor;}
|
||||
const QColor & getInterSessionLoopColor() const {return _loopInterSessionColor;}
|
||||
bool isIntraInterSessionColorsEnabled() const {return _intraInterSessionColors;}
|
||||
bool isGridMapVisible() const;
|
||||
bool isOriginVisible() const;
|
||||
bool isReferentialVisible() const;
|
||||
bool isLocalRadiusVisible() const;
|
||||
float getLoopClosureOutlierThr() const {return _loopClosureOutlierThr;}
|
||||
float getMaxLinkLength() const {return _maxLinkLength;}
|
||||
bool isGraphVisible() const;
|
||||
bool isGlobalPathVisible() const;
|
||||
bool isLocalPathVisible() const;
|
||||
bool isGtGraphVisible() const;
|
||||
bool isGPSGraphVisible() const;
|
||||
bool isOdomCacheOverlayVisible() const;
|
||||
bool isOrientationENU() const;
|
||||
ViewPlane getViewPlane() const;
|
||||
bool isEnsureFrameVisible() const;
|
||||
|
||||
// setters
|
||||
void setWorkingDirectory(const QString & path);
|
||||
void setNodeVisible(bool visible);
|
||||
void setNodeRadius(float radius);
|
||||
void setLinkWidth(float width);
|
||||
void setNodeColor(const QColor & color);
|
||||
void setNodeOdomCacheColor(const QColor & color);
|
||||
void setCurrentGoalColor(const QColor & color);
|
||||
void setNeighborColor(const QColor & color);
|
||||
void setGlobalLoopClosureColor(const QColor & color);
|
||||
void setLocalLoopClosureColor(const QColor & color);
|
||||
void setUserLoopClosureColor(const QColor & color);
|
||||
void setVirtualLoopClosureColor(const QColor & color);
|
||||
void setNeighborMergedColor(const QColor & color);
|
||||
void setLandmarkColor(const QColor & color);
|
||||
void setRejectedLoopClosureColor(const QColor & color);
|
||||
void setLocalPathColor(const QColor & color);
|
||||
void setGlobalPathColor(const QColor & color);
|
||||
void setGTColor(const QColor & color);
|
||||
void setGPSColor(const QColor & color);
|
||||
void setHighlightColor(const QColor & color, int index);
|
||||
void setIntraSessionLoopColor(const QColor & color);
|
||||
void setInterSessionLoopColor(const QColor & color);
|
||||
void setIntraInterSessionColorsEnabled(bool enabled);
|
||||
void setGridMapVisible(bool visible);
|
||||
void setOriginVisible(bool visible);
|
||||
void setReferentialVisible(bool visible);
|
||||
void setLocalRadiusVisible(bool visible);
|
||||
void setLoopClosureOutlierThr(float value);
|
||||
void setMaxLinkLength(float value);
|
||||
void setGraphVisible(bool visible);
|
||||
void setGlobalPathVisible(bool visible);
|
||||
void setLocalPathVisible(bool visible);
|
||||
void setGtGraphVisible(bool visible);
|
||||
void setGPSGraphVisible(bool visible);
|
||||
void setOdomCacheOverlayVisible(bool visible);
|
||||
void setOrientationENU(bool enabled);
|
||||
void setViewPlane(ViewPlane plane);
|
||||
void setEnsureFrameVisible(bool visible);
|
||||
|
||||
Q_SIGNALS:
|
||||
void configChanged();
|
||||
void mapShownRequested();
|
||||
void nodeSelected(int);
|
||||
void linkSelected(int, int);
|
||||
|
||||
public Q_SLOTS:
|
||||
void restoreDefaults();
|
||||
|
||||
protected:
|
||||
virtual void wheelEvent ( QWheelEvent * event );
|
||||
virtual void mouseMoveEvent(QMouseEvent * event);
|
||||
virtual void mousePressEvent(QMouseEvent * event);
|
||||
virtual void contextMenuEvent(QContextMenuEvent * event);
|
||||
|
||||
private:
|
||||
QString _workingDirectory;
|
||||
QColor _nodeColor;
|
||||
QColor _nodeOdomCacheColor;
|
||||
QColor _currentGoalColor;
|
||||
QColor _neighborColor;
|
||||
QColor _loopClosureColor;
|
||||
QColor _loopClosureLocalColor;
|
||||
QColor _loopClosureUserColor;
|
||||
QColor _loopClosureVirtualColor;
|
||||
QColor _neighborMergedColor;
|
||||
QColor _landmarkColor;
|
||||
QColor _loopClosureRejectedColor;
|
||||
QColor _localPathColor;
|
||||
QColor _globalPathColor;
|
||||
QColor _gtPathColor;
|
||||
QColor _gpsPathColor;
|
||||
QColor _loopIntraSessionColor;
|
||||
QColor _loopInterSessionColor;
|
||||
bool _intraInterSessionColors;
|
||||
float _worldMapRotation;
|
||||
QGraphicsItem * _world;
|
||||
QGraphicsItem * _root;
|
||||
QGraphicsItem * _graphRoot;
|
||||
QGraphicsItem * _globalPathRoot;
|
||||
QGraphicsItem * _localPathRoot;
|
||||
QGraphicsItem * _gtGraphRoot;
|
||||
QGraphicsItem * _gpsGraphRoot;
|
||||
QMap<int, NodeItem*> _nodeItems;
|
||||
QMultiMap<int, LinkItem*> _linkItems;
|
||||
QMap<int, NodeItem*> _gtNodeItems;
|
||||
QMap<int, NodeItem*> _gpsNodeItems;
|
||||
QMultiMap<int, LinkItem*> _gtLinkItems;
|
||||
QMultiMap<int, LinkItem*> _gpsLinkItems;
|
||||
QMultiMap<int, LinkItem*> _localPathLinkItems;
|
||||
QMultiMap<int, LinkItem*> _globalPathLinkItems;
|
||||
QVector<QPair<QColor, NodeItem*> > _highlightedNodes;
|
||||
bool _nodeVisible;
|
||||
float _nodeRadius;
|
||||
float _linkWidth;
|
||||
QGraphicsPixmapItem * _gridMap;
|
||||
QGraphicsItemGroup * _referential;
|
||||
QGraphicsItemGroup * _referentialXY;
|
||||
QGraphicsItemGroup * _referentialXZ;
|
||||
QGraphicsItemGroup * _referentialYZ;
|
||||
QGraphicsItemGroup * _originReferential;
|
||||
QGraphicsItemGroup * _originReferentialXY;
|
||||
QGraphicsItemGroup * _originReferentialXZ;
|
||||
QGraphicsItemGroup * _originReferentialYZ;
|
||||
float _gridCellSize;
|
||||
QGraphicsEllipseItem * _localRadius;
|
||||
QGraphicsRectItem * _odomCacheOverlay;
|
||||
float _loopClosureOutlierThr;
|
||||
float _maxLinkLength;
|
||||
bool _orientationENU;
|
||||
bool _mouseTracking;
|
||||
ViewPlane _viewPlane;
|
||||
bool _ensureFrameVisible;
|
||||
QPoint _previousMousePos;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* GRAPHVIEWER_H_ */
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_IMAGEVIEW_H_
|
||||
#define RTABMAP_IMAGEVIEW_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QtCore/QRectF>
|
||||
#include <QtCore/QMultiMap>
|
||||
#include <QtCore/QSettings>
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#include <map>
|
||||
#include "rtabmap/utilite/UCv2Qt.h"
|
||||
#include <rtabmap/core/CameraModel.h>
|
||||
|
||||
class QAction;
|
||||
class QMenu;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class KeypointItem;
|
||||
|
||||
class RTABMAP_GUI_EXPORT ImageView : public QWidget {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ImageView(QWidget * parent = 0);
|
||||
virtual ~ImageView();
|
||||
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
|
||||
QRectF sceneRect() const;
|
||||
bool isImageShown() const;
|
||||
bool isImageDepthShown() const;
|
||||
bool isImageDepthConfidenceShown() const;
|
||||
bool isFeaturesShown() const;
|
||||
bool isLinesShown() const;
|
||||
int getAlpha() const {return _alpha;}
|
||||
int getFeaturesSize() const {return _featuresSize;}
|
||||
int getLinesWidth() const {return _linesWidth;}
|
||||
bool isGraphicsViewMode() const;
|
||||
bool isGraphicsViewScaled() const;
|
||||
bool isGraphicsViewScaledToHeight() const;
|
||||
const QColor & getDefaultBackgroundColor() const;
|
||||
const QColor & getDefaultFeatureColor() const;
|
||||
const QColor & getDefaultMatchingFeatureColor() const;
|
||||
const QColor & getDefaultMatchingLineColor() const;
|
||||
const QColor & getBackgroundColor() const;
|
||||
float getDepthColorMapMinRange() const;
|
||||
float getDepthColorMapMaxRange() const;
|
||||
uCvQtDepthColorMap getDepthColorMap() const;
|
||||
|
||||
float viewScale() const;
|
||||
|
||||
void setFeaturesShown(bool shown);
|
||||
void setImageShown(bool shown);
|
||||
void setImageDepthShown(bool shown);
|
||||
void setImageDepthConfidenceShown(bool shown);
|
||||
void setLinesShown(bool shown);
|
||||
void setGraphicsViewMode(bool on);
|
||||
void setGraphicsViewScaled(bool scaled);
|
||||
void setGraphicsViewScaledToHeight(bool scaled);
|
||||
void setDefaultBackgroundColor(const QColor & color);
|
||||
void setDefaultFeatureColor(const QColor & color);
|
||||
void setDefaultMatchingFeatureColor(const QColor & color);
|
||||
void setDefaultMatchingLineColor(const QColor & color);
|
||||
void setBackgroundColor(const QColor & color);
|
||||
void setDepthColorMapRange(float min, float max);
|
||||
|
||||
void setFeatures(const std::multimap<int, cv::KeyPoint> & refWords, const cv::Mat & depth = cv::Mat(), const QColor & color = Qt::yellow);
|
||||
void setFeatures(const std::vector<cv::KeyPoint> & features, const cv::Mat & depth = cv::Mat(), const QColor & color = Qt::yellow);
|
||||
void addFeature(int id, const cv::KeyPoint & kpt, float depth, QColor color);
|
||||
void addLine(float x1, float y1, float x2, float y2, QColor color, const QString & text = QString());
|
||||
void setImage(const QImage & image, const std::vector<CameraModel> & models = std::vector<CameraModel>(), const Transform & pose = Transform());
|
||||
void setImageDepth(const cv::Mat & imageDepth, const cv::Mat & imageDepthConfidence = cv::Mat());
|
||||
void setImageDepth(const QImage & image, const QImage & imageDepthConfidence = QImage());
|
||||
void setFeatureColor(int id, QColor color);
|
||||
void setFeaturesColor(QColor color);
|
||||
void setAlpha(int alpha);
|
||||
void setFeaturesSize(int size);
|
||||
void setLinesWidth(int width);
|
||||
void setSceneRect(const QRectF & rect);
|
||||
|
||||
const QMultiMap<int, rtabmap::KeypointItem *> & getFeatures() const {return _features;}
|
||||
|
||||
void clearLines();
|
||||
void clearFeatures();
|
||||
void clear();
|
||||
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void configChanged();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
virtual void contextMenuEvent(QContextMenuEvent * e);
|
||||
virtual void mouseMoveEvent(QMouseEvent * event);
|
||||
|
||||
private Q_SLOTS:
|
||||
void sceneRectChanged(const QRectF &rect);
|
||||
|
||||
private:
|
||||
void updateOpacity();
|
||||
void computeScaleOffsets(const QRect & targetRect, float & scale, float & offsetX, float & offsetY) const;
|
||||
QIcon createIcon(const QColor & color);
|
||||
|
||||
private:
|
||||
QString _savedFileName;
|
||||
int _alpha;
|
||||
int _featuresSize;
|
||||
int _linesWidth;
|
||||
QColor _defaultBgColor;
|
||||
QColor _defaultFeatureColor;
|
||||
QColor _defaultMatchingFeatureColor;
|
||||
QColor _defaultMatchingLineColor;
|
||||
float _depthColorMapMinRange;
|
||||
float _depthColorMapMaxRange;
|
||||
|
||||
QMenu * _menu;
|
||||
QAction * _showImage;
|
||||
QAction * _showImageDepth;
|
||||
QAction * _showImageDepthConfidence;
|
||||
QAction * _showFeatures;
|
||||
QAction * _showLines;
|
||||
QAction * _setFeatureColor;
|
||||
QAction * _setMatchingFeatureColor;
|
||||
QAction * _setMatchingLineColor;
|
||||
QAction * _saveImage;
|
||||
QAction * _setAlpha;
|
||||
QAction * _setFeaturesSize;
|
||||
QAction * _setLinesWidth;
|
||||
QAction * _graphicsViewMode;
|
||||
QAction * _graphicsViewScaled;
|
||||
QAction * _graphicsViewScaledToHeight;
|
||||
QAction * _graphicsViewNoScaling;
|
||||
QAction * _colorMapWhiteToBlack;
|
||||
QAction * _colorMapBlackToWhite;
|
||||
QAction * _colorMapRedToBlue;
|
||||
QAction * _colorMapBlueToRed;
|
||||
QAction * _colorMapMinRange;
|
||||
QAction * _colorMapMaxRange;
|
||||
QAction * _mouseTracking;
|
||||
QMenu * _featureMenu;
|
||||
QMenu * _scaleMenu;
|
||||
|
||||
QGraphicsView * _graphicsView;
|
||||
QMultiMap<int, rtabmap::KeypointItem *> _features;
|
||||
QList<QGraphicsLineItem*> _lines;
|
||||
QGraphicsPixmapItem * _imageItem;
|
||||
QGraphicsPixmapItem * _imageDepthItem;
|
||||
QGraphicsPixmapItem * _imageDepthConfidenceItem;
|
||||
QPixmap _image;
|
||||
QPixmap _imageDepth;
|
||||
QPixmap _imageDepthConfidence;
|
||||
cv::Mat _imageDepthCv;
|
||||
cv::Mat _imageDepthConfidenceCv;
|
||||
std::vector<CameraModel> _models;
|
||||
Transform _pose;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* IMAGEVIEW_H_ */
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_KEYPOINTITEM_H_
|
||||
#define RTABMAP_KEYPOINTITEM_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QGraphicsEllipseItem>
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QtGui/QPen>
|
||||
#include <QtGui/QBrush>
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT KeypointItem : public QGraphicsEllipseItem
|
||||
{
|
||||
public:
|
||||
KeypointItem(int id, const cv::KeyPoint & kpt, float depth = 0, const QColor & color = Qt::green, QGraphicsItem * parent = 0);
|
||||
virtual ~KeypointItem();
|
||||
|
||||
void setColor(const QColor & color);
|
||||
const cv::KeyPoint & keypoint() const {return _kpt;}
|
||||
|
||||
protected:
|
||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
virtual void focusInEvent ( QFocusEvent * event );
|
||||
virtual void focusOutEvent ( QFocusEvent * event );
|
||||
|
||||
private:
|
||||
void showDescription();
|
||||
void hideDescription();
|
||||
|
||||
private:
|
||||
int _id;
|
||||
cv::KeyPoint _kpt;
|
||||
QGraphicsRectItem * _placeHolder;
|
||||
int _width;
|
||||
float _depth;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* KEYPOINTITEM_H_ */
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_LINKREFININGDIALOG_H_
|
||||
#define RTABMAP_LINKREFININGDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <rtabmap/core/Link.h>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class Ui_linkRefiningDialog;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT LinkRefiningDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LinkRefiningDialog(QWidget * parent = 0);
|
||||
|
||||
virtual ~LinkRefiningDialog();
|
||||
|
||||
void setMinMax(
|
||||
int nodeIdMin,
|
||||
int nodeIdMax,
|
||||
int mapIdMin,
|
||||
int mapIdMax);
|
||||
|
||||
Link::Type getLinkType() const;
|
||||
void getIntraInterSessions(bool & intra, bool & inter) const;
|
||||
bool isRangeByNodeId() const;
|
||||
bool isRangeByMapId() const;
|
||||
void getRangeNodeId(int & from, int & to) const;
|
||||
void getRangeMapId(int & from, int & to) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void restoreDefaults();
|
||||
void updateIntraInterState();
|
||||
void setRangeToNodeId();
|
||||
void setRangeToMapId();
|
||||
|
||||
private:
|
||||
Ui_linkRefiningDialog * ui_;
|
||||
int defaultNodeIdMin_;
|
||||
int defaultNodeIdMax_;
|
||||
int defaultMapIdMin_;
|
||||
int defaultMapIdMax_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* RTABMAP_LINKREFININGDIALOG_H_ */
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_LOOPCLOSUREVIEWER_H_
|
||||
#define RTABMAP_LOOPCLOSUREVIEWER_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <rtabmap/core/Parameters.h>
|
||||
#include <rtabmap/core/Transform.h>
|
||||
#include <rtabmap/core/Signature.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <QWidget>
|
||||
|
||||
class Ui_loopClosureViewer;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT LoopClosureViewer : public QWidget {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LoopClosureViewer(QWidget * parent = 0);
|
||||
virtual ~LoopClosureViewer();
|
||||
|
||||
void setData(const Signature & sA, const Signature & sB); // sB contains loop transform as pose() from sA
|
||||
|
||||
const Signature & sA() const {return sA_;}
|
||||
const Signature & sB() const {return sB_;}
|
||||
|
||||
public Q_SLOTS:
|
||||
void setDecimation(int decimation) {decimation_ = decimation;}
|
||||
void setMaxDepth(int maxDepth) {maxDepth_ = maxDepth;}
|
||||
void setMinDepth(int minDepth) {minDepth_ = minDepth;}
|
||||
void updateView(const Transform & AtoB = Transform(), const ParametersMap & parameters = ParametersMap());
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent * event);
|
||||
|
||||
private:
|
||||
Ui_loopClosureViewer * ui_;
|
||||
|
||||
Signature sA_;
|
||||
Signature sB_;
|
||||
Transform transform_;
|
||||
|
||||
int decimation_;
|
||||
float maxDepth_;
|
||||
float minDepth_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* LOOPCLOSUREVIEWER_H_ */
|
||||
@@ -0,0 +1,436 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_MAINWINDOW_H_
|
||||
#define RTABMAP_MAINWINDOW_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include "rtabmap/utilite/UEventsHandler.h"
|
||||
#include <QMainWindow>
|
||||
#include <QtCore/QSet>
|
||||
#include <QElapsedTimer>
|
||||
#include "rtabmap/core/RtabmapEvent.h"
|
||||
#include "rtabmap/core/SensorData.h"
|
||||
#include "rtabmap/core/OdometryEvent.h"
|
||||
#include "rtabmap/core/Optimizer.h"
|
||||
#include "rtabmap/core/GlobalMap.h"
|
||||
#include "rtabmap/gui/PreferencesDialog.h"
|
||||
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/PolygonMesh.h>
|
||||
#include <pcl/pcl_base.h>
|
||||
#include <pcl/TextureMesh.h>
|
||||
#include <rtabmap/core/SensorCaptureInfo.h>
|
||||
|
||||
namespace rtabmap {
|
||||
class SensorCaptureThread;
|
||||
class OdometryThread;
|
||||
class IMUThread;
|
||||
class CloudViewer;
|
||||
class LoopClosureViewer;
|
||||
class OccupancyGrid;
|
||||
}
|
||||
|
||||
class QGraphicsScene;
|
||||
class Ui_mainWindow;
|
||||
class QActionGroup;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class LikelihoodScene;
|
||||
class AboutDialog;
|
||||
class Plot;
|
||||
class PdfPlotCurve;
|
||||
class StatsToolBox;
|
||||
class ProgressDialog;
|
||||
class TwistGridWidget;
|
||||
class ExportCloudsDialog;
|
||||
class ExportBundlerDialog;
|
||||
class PostProcessingDialog;
|
||||
class DepthCalibrationDialog;
|
||||
class DataRecorder;
|
||||
class OctoMap;
|
||||
class GridMap;
|
||||
class MultiSessionLocWidget;
|
||||
|
||||
class RTABMAP_GUI_EXPORT MainWindow : public QMainWindow, public UEventsHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum State {
|
||||
kIdle,
|
||||
kInitializing,
|
||||
kInitialized,
|
||||
kApplicationClosing,
|
||||
kClosing,
|
||||
kStartingDetection,
|
||||
kDetecting,
|
||||
kPaused,
|
||||
kMonitoring,
|
||||
kMonitoringPaused
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* @param prefDialog If NULL, a default dialog is created. This
|
||||
* dialog is automatically destroyed with the MainWindow.
|
||||
*/
|
||||
MainWindow(PreferencesDialog * prefDialog = 0, QWidget * parent = 0, bool showSplashScreen = true);
|
||||
virtual ~MainWindow();
|
||||
|
||||
QString getWorkingDirectory() const;
|
||||
void setMonitoringState(bool pauseChecked = false); // in monitoring state, only some actions are enabled
|
||||
bool isSavedMaximized() const {return _savedMaximized;}
|
||||
|
||||
bool isProcessingStatistics() const {return _processingStatistics;}
|
||||
bool isProcessingOdometry() const {return _processingOdometry;}
|
||||
|
||||
bool isDatabaseUpdated() const { return _databaseUpdated; }
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void processStats(const rtabmap::Statistics & stat);
|
||||
void updateCacheFromDatabase(const QString & path);
|
||||
void openDatabase(const QString & path, const rtabmap::ParametersMap & overridedParameters = rtabmap::ParametersMap());
|
||||
void updateParameters(const rtabmap::ParametersMap & parameters);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
virtual bool handleEvent(UEvent* anEvent);
|
||||
virtual void showEvent(QShowEvent* anEvent);
|
||||
virtual void moveEvent(QMoveEvent* anEvent);
|
||||
virtual void resizeEvent(QResizeEvent* anEvent);
|
||||
virtual void keyPressEvent(QKeyEvent *event);
|
||||
virtual bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void changeState(MainWindow::State state);
|
||||
virtual void newDatabase();
|
||||
virtual void openDatabase();
|
||||
virtual bool closeDatabase();
|
||||
virtual void startDetection();
|
||||
virtual void pauseDetection();
|
||||
virtual void stopDetection();
|
||||
virtual void saveConfigGUI();
|
||||
virtual void downloadAllClouds();
|
||||
virtual void downloadPoseGraph();
|
||||
virtual void clearTheCache();
|
||||
virtual void openHelp();
|
||||
virtual void openPreferences();
|
||||
virtual void openPreferencesSource();
|
||||
virtual void setDefaultViews();
|
||||
virtual void resetOdometry();
|
||||
virtual void triggerNewMap();
|
||||
virtual void deleteMemory();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void beep();
|
||||
void cancelProgress();
|
||||
void configGUIModified();
|
||||
void editDatabase();
|
||||
void notifyNoMoreImages();
|
||||
void printLoopClosureIds();
|
||||
void generateGraphDOT();
|
||||
void exportPosesRaw();
|
||||
void exportPosesRGBDSLAM();
|
||||
void exportPosesRGBDSLAMMotionCapture();
|
||||
void exportPosesRGBDSLAMID();
|
||||
void exportPosesKITTI();
|
||||
void exportPosesTORO();
|
||||
void exportPosesG2O();
|
||||
void exportImages();
|
||||
void exportOctomap();
|
||||
void showPostProcessingDialog();
|
||||
void depthCalibration();
|
||||
void openWorkingDirectory();
|
||||
void updateEditMenu();
|
||||
void selectOpenni();
|
||||
void selectFreenect();
|
||||
void selectOpenniCv();
|
||||
void selectOpenniCvAsus();
|
||||
void selectOpenni2();
|
||||
void selectFreenect2();
|
||||
void selectK4W2();
|
||||
void selectK4A();
|
||||
void selectRealSense();
|
||||
void selectRealSense2();
|
||||
void selectRealSense2L515();
|
||||
void selectRealSense2Stereo();
|
||||
void selectStereoDC1394();
|
||||
void selectStereoFlyCapture2();
|
||||
void selectStereoZed();
|
||||
void selectStereoZedOC();
|
||||
void selectStereoTara();
|
||||
void selectStereoUsb();
|
||||
void selectMyntEyeS();
|
||||
void selectDepthAIOAKD();
|
||||
void selectDepthAIOAKDLite();
|
||||
void selectDepthAIOAKDPro();
|
||||
void selectXvisioSeerSense();
|
||||
void selectVLP16();
|
||||
void dumpTheMemory();
|
||||
void dumpThePrediction();
|
||||
void sendGoal();
|
||||
void sendWaypoints();
|
||||
void postGoal();
|
||||
void postGoal(const QString & goal);
|
||||
void cancelGoal();
|
||||
void label();
|
||||
void removeLabel();
|
||||
void updateCacheFromDatabase();
|
||||
void anchorCloudsToGroundTruth();
|
||||
void selectScreenCaptureFormat(bool checked);
|
||||
void takeScreenshot();
|
||||
void updateElapsedTime();
|
||||
void processCameraInfo(const rtabmap::SensorCaptureInfo & info);
|
||||
void processOdometry(const rtabmap::OdometryEvent & odom, bool dataIgnored);
|
||||
void applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags);
|
||||
void applyPrefSettings(const rtabmap::ParametersMap & parameters);
|
||||
void processRtabmapEventInit(int status, const QString & info);
|
||||
void processRtabmapEvent3DMap(const rtabmap::RtabmapEvent3DMap & event);
|
||||
void processRtabmapGlobalPathEvent(const rtabmap::RtabmapGlobalPathEvent & event);
|
||||
void processRtabmapLabelErrorEvent(int id, const QString & label);
|
||||
void processRtabmapGoalStatusEvent(int status);
|
||||
void changeImgRateSetting();
|
||||
void changeDetectionRateSetting();
|
||||
void changeTimeLimitSetting();
|
||||
void changeMappingMode();
|
||||
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();
|
||||
void setAspectRatioCustom();
|
||||
void exportGridMap();
|
||||
void exportClouds();
|
||||
void exportBundlerFormat();
|
||||
void viewClouds();
|
||||
void dataRecorder();
|
||||
void dataRecorderDestroyed();
|
||||
void updateNodeVisibility(int, bool);
|
||||
void updateGraphView();
|
||||
|
||||
Q_SIGNALS:
|
||||
void statsReceived(const rtabmap::Statistics &);
|
||||
void statsProcessed();
|
||||
void cameraInfoReceived(const rtabmap::SensorCaptureInfo &);
|
||||
void cameraInfoProcessed();
|
||||
void odometryReceived(const rtabmap::OdometryEvent &, bool);
|
||||
void odometryProcessed();
|
||||
void thresholdsChanged(int, int);
|
||||
void stateChanged(MainWindow::State);
|
||||
void rtabmapEventInitReceived(int status, const QString & info);
|
||||
void rtabmapEvent3DMapReceived(const rtabmap::RtabmapEvent3DMap & event);
|
||||
void rtabmapEvent3DMapProcessed();
|
||||
void rtabmapGlobalPathEventReceived(const rtabmap::RtabmapGlobalPathEvent & event);
|
||||
void rtabmapLabelErrorReceived(int id, const QString & label);
|
||||
void rtabmapGoalStatusEventReceived(int status);
|
||||
void imgRateChanged(double);
|
||||
void detectionRateChanged(double);
|
||||
void timeLimitChanged(float);
|
||||
void mappingModeChanged(bool);
|
||||
void noMoreImagesReceived();
|
||||
void loopClosureThrChanged(qreal);
|
||||
void twistReceived(float x, float y, float z, float roll, float pitch, float yaw, int row, int col);
|
||||
|
||||
private:
|
||||
void update3DMapVisibility(bool cloudsShown, bool scansShown);
|
||||
void updateMapCloud(
|
||||
const std::map<int, Transform> & poses,
|
||||
const std::multimap<int, Link> & constraints,
|
||||
const std::map<int, int> & mapIds,
|
||||
const std::map<int, std::string> & labels,
|
||||
const std::map<int, Transform> & groundTruths,
|
||||
const std::map<int, Transform> & odomCachePoses = std::map<int, Transform>(),
|
||||
const std::multimap<int, Link> & odomCacheConstraints = std::multimap<int, Link>(),
|
||||
bool verboseProgress = false,
|
||||
std::map<std::string, float> * stats = 0);
|
||||
std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> createAndAddCloudToMap(int nodeId, const Transform & pose, int mapId);
|
||||
void createAndAddScanToMap(int nodeId, const Transform & pose, int mapId);
|
||||
void createAndAddFeaturesToMap(int nodeId, const Transform & pose, int mapId);
|
||||
Transform alignPosesToGroundTruth(const std::map<int, Transform> & poses, const std::map<int, Transform> & groundTruth);
|
||||
void drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords, const std::multimap<int, cv::KeyPoint> & loopWords);
|
||||
void drawLandmarks(cv::Mat & image, const Signature & signature);
|
||||
void setupMainLayout(bool vertical);
|
||||
void updateSelectSourceMenu();
|
||||
void applyPrefSettings(const rtabmap::ParametersMap & parameters, bool postParamEvent);
|
||||
void saveFigures();
|
||||
void loadFigures();
|
||||
void exportPoses(int format);
|
||||
QString captureScreen(bool cacheInRAM = false, bool png = true);
|
||||
|
||||
protected:
|
||||
Ui_mainWindow * ui() { return _ui; }
|
||||
const State & state() const { return _state; }
|
||||
|
||||
const QMap<int, Signature> & cachedSignatures() const { return _cachedSignatures;}
|
||||
const std::map<int, Transform> & currentPosesMap() const { return _currentPosesMap; } // <nodeId, pose>
|
||||
const std::map<int, Transform> & currentGTPosesMap() const { return _currentGTPosesMap; } // <nodeId, pose>
|
||||
std::map<int, Transform> currentVisiblePosesMap() const; // <nodeId, pose>
|
||||
const std::multimap<int, Link> & currentLinksMap() const { return _currentLinksMap; } // <nodeFromId, link>
|
||||
const std::map<int, int> & currentMapIds() const { return _currentMapIds; } // <nodeId, mapId>
|
||||
const std::map<int, std::string> & currentLabels() const { return _currentLabels; } // <nodeId, label>
|
||||
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds() const { return _cachedClouds; }
|
||||
const std::map<int, LaserScan> & createdScans() const { return _createdScans; }
|
||||
const std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & createdFeatures() const { return _createdFeatures; }
|
||||
|
||||
const rtabmap::OccupancyGrid * occupancyGrid() const { return _occupancyGrid; }
|
||||
const rtabmap::OctoMap * octomap() const { return _octomap; }
|
||||
|
||||
rtabmap::ProgressDialog * progressDialog() { return _progressDialog; }
|
||||
rtabmap::CloudViewer * cloudViewer() const { return _cloudViewer; }
|
||||
rtabmap::LoopClosureViewer * loopClosureViewer() const { return _loopClosureViewer; }
|
||||
|
||||
void setCloudViewer(rtabmap::CloudViewer * cloudViewer);
|
||||
void setLoopClosureViewer(rtabmap::LoopClosureViewer * loopClosureViewer);
|
||||
|
||||
void setNewDatabasePathOutput(const QString & newDatabasePathOutput) {_newDatabasePathOutput = newDatabasePathOutput;}
|
||||
const QString & newDatabasePathOutput() const { return _newDatabasePathOutput; }
|
||||
|
||||
virtual ParametersMap getCustomParameters() {return ParametersMap();}
|
||||
|
||||
void postProcessing(
|
||||
bool refineNeighborLinks,
|
||||
bool refineLoopClosureLinks,
|
||||
// Detect more loop closures params:
|
||||
bool detectMoreLoopClosures,
|
||||
double clusterRadius,
|
||||
double clusterAngle,
|
||||
int iterations,
|
||||
bool interSession,
|
||||
bool intraSession,
|
||||
// SBA params:
|
||||
bool sba,
|
||||
int sbaIterations,
|
||||
double sbaVariance,
|
||||
Optimizer::Type sbaType,
|
||||
double sbaRematchFeatures,
|
||||
bool abortIfDataMissing = true);
|
||||
|
||||
private:
|
||||
Ui_mainWindow * _ui;
|
||||
|
||||
State _state;
|
||||
rtabmap::SensorCaptureThread * _sensorCapture;
|
||||
rtabmap::OdometryThread * _odomThread;
|
||||
rtabmap::IMUThread * _imuThread;
|
||||
|
||||
//Dialogs
|
||||
PreferencesDialog * _preferencesDialog;
|
||||
AboutDialog * _aboutDialog;
|
||||
ExportCloudsDialog * _exportCloudsDialog;
|
||||
ExportBundlerDialog * _exportBundlerDialog;
|
||||
PostProcessingDialog * _postProcessingDialog;
|
||||
DepthCalibrationDialog * _depthCalibrationDialog;
|
||||
DataRecorder * _dataRecorder;
|
||||
|
||||
QSet<int> _lastIds;
|
||||
int _lastId;
|
||||
double _firstStamp;
|
||||
bool _processingStatistics;
|
||||
bool _processingDownloadedMap;
|
||||
bool _recovering;
|
||||
bool _odometryReceived;
|
||||
QString _newDatabasePath;
|
||||
QString _newDatabasePathOutput;
|
||||
QString _openedDatabasePath;
|
||||
QString _defaultOpenDatabasePath;
|
||||
bool _databaseUpdated;
|
||||
bool _odomImageShow;
|
||||
bool _odomImageDepthShow;
|
||||
bool _savedMaximized;
|
||||
QStringList _waypoints;
|
||||
int _waypointsIndex;
|
||||
std::vector<CameraModel> _rectCameraModels;
|
||||
std::vector<CameraModel> _rectCameraModelsOdom;
|
||||
|
||||
QMap<int, Signature> _cachedSignatures;
|
||||
long _cachedMemoryUsage;
|
||||
std::map<int, Transform> _currentPosesMap; // <nodeId, pose>
|
||||
std::map<int, Transform> _currentGTPosesMap; // <nodeId, pose>
|
||||
std::multimap<int, Link> _currentLinksMap; // <nodeFromId, link>
|
||||
std::map<int, int> _currentMapIds; // <nodeId, mapId>
|
||||
std::map<int, std::string> _currentLabels; // <nodeId, label>
|
||||
std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > _cachedClouds;
|
||||
long _createdCloudsMemoryUsage;
|
||||
std::set<int> _cachedEmptyClouds;
|
||||
std::pair<int, std::pair<std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr>, pcl::IndicesPtr> > _previousCloud; // used for subtraction
|
||||
std::map<int, float> _cachedWordsCount;
|
||||
std::map<int, float> _cachedLocalizationsCount;
|
||||
rtabmap::LocalGridCache _cachedLocalMaps;
|
||||
|
||||
std::map<int, LaserScan> _createdScans;
|
||||
|
||||
rtabmap::OccupancyGrid * _occupancyGrid;
|
||||
rtabmap::OctoMap * _octomap;
|
||||
rtabmap::GridMap * _elevationMap;
|
||||
|
||||
std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> _createdFeatures;
|
||||
|
||||
Transform _odometryCorrection;
|
||||
Transform _lastOdomPose;
|
||||
bool _processingOdometry;
|
||||
|
||||
QTimer * _oneSecondTimer;
|
||||
QElapsedTimer * _elapsedTime;
|
||||
QElapsedTimer * _logEventTime;
|
||||
|
||||
PdfPlotCurve * _posteriorCurve;
|
||||
PdfPlotCurve * _likelihoodCurve;
|
||||
PdfPlotCurve * _rawLikelihoodCurve;
|
||||
|
||||
MultiSessionLocWidget * _multiSessionLocWidget;
|
||||
|
||||
ProgressDialog * _progressDialog;
|
||||
|
||||
CloudViewer * _cloudViewer;
|
||||
LoopClosureViewer * _loopClosureViewer;
|
||||
|
||||
QString _graphSavingFileName;
|
||||
int _exportPosesFrame;
|
||||
QMap<int, QString> _exportPosesFileName;
|
||||
bool _autoScreenCaptureOdomSync;
|
||||
bool _autoScreenCaptureRAM;
|
||||
bool _autoScreenCapturePNG;
|
||||
QMap<QString, QByteArray> _autoScreenCaptureCachedImages;
|
||||
|
||||
QVector<int> _refIds;
|
||||
QVector<int> _loopClosureIds;
|
||||
|
||||
bool _firstCall;
|
||||
bool _progressCanceled;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* RTABMAP_MainWindow_H_ */
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_MAPVISIBILITYWIDGET_H_
|
||||
#define RTABMAP_MAPVISIBILITYWIDGET_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QWidget>
|
||||
#include <rtabmap/core/Transform.h>
|
||||
#include <map>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT MapVisibilityWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
MapVisibilityWidget(QWidget * parent = 0);
|
||||
virtual ~MapVisibilityWidget();
|
||||
|
||||
void setMap(const std::map<int, Transform> & poses, const std::map<int, bool> & mask);
|
||||
std::map<int, Transform> getVisiblePoses() const;
|
||||
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent * event);
|
||||
|
||||
private Q_SLOTS:
|
||||
void signalVisibility();
|
||||
void selectAll(bool);
|
||||
|
||||
private:
|
||||
void updateCheckBoxes();
|
||||
|
||||
Q_SIGNALS:
|
||||
void visibilityChanged(int id, bool visible);
|
||||
|
||||
private:
|
||||
std::map<int, Transform> _poses;
|
||||
std::map<int, bool> _mask;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* MAPVISIBILITYWIDGET_H_ */
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_MULTISESSIONLOCSUBVIEW_H_
|
||||
#define RTABMAP_MULTISESSIONLOCSUBVIEW_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
#include <opencv2/core.hpp>
|
||||
#include <QWidget>
|
||||
|
||||
class Ui_multiSessionLocSubView;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class ImageView;
|
||||
|
||||
class RTABMAP_GUI_EXPORT MultiSessionLocSubView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MultiSessionLocSubView(ImageView * mainView, int mapId, QWidget * parent = 0);
|
||||
virtual ~MultiSessionLocSubView();
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateView(
|
||||
int nodeId,
|
||||
const QImage & image,
|
||||
const std::multimap<int, cv::KeyPoint> & features,
|
||||
float locRatio,
|
||||
const QColor & bgColor);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
Ui_multiSessionLocSubView * ui_;
|
||||
int mapId_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* RTABMAP_MULTISESSIONLOCSUBVIEW_H_ */
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_MULTISESSIONLOCWIDGET_H_
|
||||
#define RTABMAP_MULTISESSIONLOCWIDGET_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include "rtabmap/core/Statistics.h"
|
||||
#include "rtabmap/core/Signature.h"
|
||||
#include <QWidget>
|
||||
|
||||
class QPushButton;
|
||||
class QProgressBar;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class MultiSessionLocSubView;
|
||||
class ImageView;
|
||||
|
||||
class RTABMAP_GUI_EXPORT MultiSessionLocWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MultiSessionLocWidget(
|
||||
const QMap<int, Signature> * cache,
|
||||
const std::map<int, int> * mapIds,
|
||||
QWidget * parent = 0);
|
||||
virtual ~MultiSessionLocWidget();
|
||||
|
||||
ImageView * getImageView() {return imageView_;}
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateView(
|
||||
const Signature & lastSignature,
|
||||
const Statistics & stats);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
const QMap<int, Signature> * cache_;
|
||||
const std::map<int, int> * mapIds_;
|
||||
std::map<int, std::pair<MultiSessionLocSubView*, int> > subViews_;
|
||||
ImageView * imageView_;
|
||||
QProgressBar * totalLocProgressBar_;
|
||||
QPushButton * resetbutton_;
|
||||
int totalFrames_;
|
||||
int totalLoops_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* RTABMAP_MULTISESSIONLOCWIDGET_H_ */
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_ODOMETRYVIEWER_H_
|
||||
#define RTABMAP_ODOMETRYVIEWER_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include "rtabmap/core/OdometryEvent.h"
|
||||
#include "rtabmap/core/Parameters.h"
|
||||
#include <QDialog>
|
||||
#include "rtabmap/utilite/UEventsHandler.h"
|
||||
|
||||
class QSpinBox;
|
||||
class QDoubleSpinBox;
|
||||
class QLabel;
|
||||
class QCheckBox;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class ImageView;
|
||||
class CloudViewer;
|
||||
|
||||
class RTABMAP_GUI_EXPORT OdometryViewer : public QDialog, public UEventsHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OdometryViewer(
|
||||
int maxClouds = 10,
|
||||
int decimation = 2,
|
||||
float voxelSize = 0.0f,
|
||||
float maxDepth = 0,
|
||||
int qualityWarningThr=0,
|
||||
QWidget * parent = 0,
|
||||
const ParametersMap & parameters = ParametersMap());
|
||||
virtual ~OdometryViewer();
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void clear();
|
||||
|
||||
protected:
|
||||
virtual bool handleEvent(UEvent * event);
|
||||
|
||||
private Q_SLOTS:
|
||||
void reset();
|
||||
void processData(const rtabmap::OdometryEvent & odom);
|
||||
|
||||
private:
|
||||
ImageView* imageView_;
|
||||
CloudViewer* cloudView_;
|
||||
bool processingData_;
|
||||
bool odomImageShow_;
|
||||
bool odomImageDepthShow_;
|
||||
|
||||
Transform lastOdomPose_;
|
||||
int qualityWarningThr_;
|
||||
int id_;
|
||||
QList<std::string> addedClouds_;
|
||||
|
||||
QSpinBox * maxCloudsSpin_;
|
||||
QDoubleSpinBox * voxelSpin_;
|
||||
QSpinBox * decimationSpin_;
|
||||
QDoubleSpinBox * maxDepthSpin_;
|
||||
QCheckBox * cloudShown_;
|
||||
QCheckBox * scanShown_;
|
||||
QCheckBox * featuresShown_;
|
||||
QLabel * timeLabel_;
|
||||
int validDecimationValue_;
|
||||
ParametersMap parameters_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
#endif /* ODOMETRYVIEWER_H_ */
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
//
|
||||
// Original version from Find-Object: https://github.com/introlab/find-object
|
||||
//
|
||||
|
||||
#ifndef RTABMAP_PARAMETERSTOOLBOX_H_
|
||||
#define RTABMAP_PARAMETERSTOOLBOX_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <rtabmap/core/Parameters.h>
|
||||
#include <QWidget>
|
||||
#include <QSet>
|
||||
|
||||
class QVBoxLayout;
|
||||
class QStackedWidget;
|
||||
class QComboBox;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT ParametersToolBox: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ParametersToolBox(QWidget *parent = 0);
|
||||
virtual ~ParametersToolBox();
|
||||
|
||||
void setupUi(const ParametersMap & parameters);
|
||||
QWidget * getParameterWidget(const QString & key);
|
||||
void updateParameter(const std::string & key, const std::string & value);
|
||||
const ParametersMap & getParameters() const {return parameters_;}
|
||||
|
||||
private:
|
||||
void addParameter(QVBoxLayout * layout, const std::string & key, const std::string & value);
|
||||
void addParameter(QVBoxLayout * layout, const QString & key, const QString & value);
|
||||
void addParameter(QVBoxLayout * layout, const QString & key, const int & value);
|
||||
void addParameter(QVBoxLayout * layout, const QString & key, const double & value);
|
||||
void addParameter(QVBoxLayout * layout, const QString & key, const bool & value);
|
||||
void addParameter(QVBoxLayout * layout, const QString & name, QWidget * widget);
|
||||
|
||||
Q_SIGNALS:
|
||||
void parametersChanged(const QStringList & name);
|
||||
|
||||
private Q_SLOTS:
|
||||
void changeParameter();
|
||||
void changeParameter(const QString & value);
|
||||
void changeParameter(const int & value);
|
||||
void resetCurrentPage();
|
||||
void resetAllPages();
|
||||
|
||||
private:
|
||||
QStringList resetPage(int index);
|
||||
void updateParametersVisibility();
|
||||
|
||||
private:
|
||||
QComboBox * comboBox_;
|
||||
QStackedWidget * stackedWidget_;
|
||||
ParametersMap parameters_;
|
||||
};
|
||||
|
||||
} // namespace find_object
|
||||
|
||||
#endif /* PARAMETERSTOOLBOX_H_ */
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_PDFPLOT_H_
|
||||
#define RTABMAP_PDFPLOT_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <rtabmap/utilite/UPlot.h>
|
||||
#include "opencv2/opencv.hpp"
|
||||
#include "rtabmap/core/Signature.h"
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT PdfPlotItem : public UPlotItem
|
||||
{
|
||||
public:
|
||||
PdfPlotItem(float dataX, float dataY, float width, int childCount = -1);
|
||||
virtual ~PdfPlotItem();
|
||||
|
||||
void setLikelihood(int id, float value, int childCount);
|
||||
void setSignaturesRef(const QMap<int, Signature> * signaturesRef) {_signaturesRef = signaturesRef;}
|
||||
|
||||
float value() const {return this->data().y();}
|
||||
int id() const {return this->data().x();}
|
||||
|
||||
protected:
|
||||
virtual void showDescription(bool shown);
|
||||
|
||||
private:
|
||||
QGraphicsPixmapItem * _img;
|
||||
int _childCount;
|
||||
const QMap<int, Signature> * _signaturesRef;
|
||||
QGraphicsTextItem * _text;
|
||||
|
||||
};
|
||||
|
||||
class RTABMAP_GUI_EXPORT PdfPlotCurve : public UPlotCurve
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PdfPlotCurve(const QString & name, const QMap<int, Signature> * signaturesMapRef, QObject * parent = 0);
|
||||
virtual ~PdfPlotCurve();
|
||||
|
||||
virtual void clear();
|
||||
void setData(const QMap<int, float> & dataMap, const QMap<int, int> & weightsMap);
|
||||
|
||||
private:
|
||||
const QMap<int, Signature> * _signaturesMapRef;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* PDFPLOT_H_ */
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_POSTPROCESSINGDIALOG_H_
|
||||
#define RTABMAP_POSTPROCESSINGDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <rtabmap/core/Optimizer.h>
|
||||
|
||||
class Ui_PostProcessingDialog;
|
||||
class QAbstractButton;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT PostProcessingDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PostProcessingDialog(QWidget * parent = 0);
|
||||
|
||||
virtual ~PostProcessingDialog();
|
||||
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
|
||||
//getters
|
||||
bool isDetectMoreLoopClosures() const;
|
||||
double clusterRadius() const;
|
||||
double clusterAngle() const;
|
||||
int iterations() const;
|
||||
bool intraSession() const;
|
||||
bool interSession() const;
|
||||
bool isRefineNeighborLinks() const;
|
||||
bool isRefineLoopClosureLinks() const;
|
||||
bool isSBA() const;
|
||||
int sbaIterations() const;
|
||||
double sbaVariance() const;
|
||||
Optimizer::Type sbaType() const;
|
||||
bool sbaRematchFeatures() const;
|
||||
|
||||
//setters
|
||||
void setDetectMoreLoopClosures(bool on);
|
||||
void setClusterRadius(double radius);
|
||||
void setClusterAngle(double angle);
|
||||
void setIterations(int iterations);
|
||||
void setIntraSession(bool enabled);
|
||||
void setInterSession(bool enabled);
|
||||
void setRefineNeighborLinks(bool on);
|
||||
void setRefineLoopClosureLinks(bool on);
|
||||
void setSBA(bool on);
|
||||
void setSBAIterations(int iterations);
|
||||
void setSBAVariance(double variance);
|
||||
void setSBAType(Optimizer::Type type);
|
||||
void setSBARematchFeatures(bool value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void configChanged();
|
||||
|
||||
public Q_SLOTS:
|
||||
void closeDialog ( QAbstractButton * button );
|
||||
void restoreDefaults();
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateVisibility();
|
||||
void updateButtonBox();
|
||||
|
||||
private:
|
||||
bool validateForm();
|
||||
|
||||
private:
|
||||
Ui_PostProcessingDialog * _ui;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* POSTPROCESSINGDIALOG_H_ */
|
||||
@@ -0,0 +1,493 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_PREFERENCESDIALOG_H_
|
||||
#define RTABMAP_PREFERENCESDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtCore/QModelIndex>
|
||||
#include <QtCore/QVector>
|
||||
#include <set>
|
||||
|
||||
#include "rtabmap/core/Transform.h"
|
||||
#include "rtabmap/core/Parameters.h"
|
||||
|
||||
class Ui_preferencesDialog;
|
||||
class QAbstractItemModel;
|
||||
class QAbstractButton;
|
||||
class QStandardItemModel;
|
||||
class QStandardItem;
|
||||
class QFile;
|
||||
class QGroupBox;
|
||||
class QMainWindow;
|
||||
class QLineEdit;
|
||||
class QSlider;
|
||||
class QProgressDialog;
|
||||
class UPlotCurve;
|
||||
class QStackedWidget;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QDoubleSpinBox;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class Signature;
|
||||
class LoopClosureViewer;
|
||||
class Camera;
|
||||
class SensorCapture;
|
||||
class Lidar;
|
||||
class CalibrationDialog;
|
||||
class CreateSimpleCalibrationDialog;
|
||||
|
||||
class RTABMAP_GUI_EXPORT PreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum PanelFlag {
|
||||
kPanelDummy = 0,
|
||||
kPanelGeneral = 1,
|
||||
kPanelCloudRendering = 2,
|
||||
kPanelLogging = 4,
|
||||
kPanelSource = 8,
|
||||
kPanelCalibration = 16,
|
||||
kPanelAll = 31
|
||||
};
|
||||
// TODO, tried to change the name of PANEL_FLAGS to PanelFlags... but signals/slots errors appeared...
|
||||
Q_DECLARE_FLAGS(PANEL_FLAGS, PanelFlag);
|
||||
|
||||
enum Src {
|
||||
kSrcUndef = -1,
|
||||
|
||||
kSrcRGBD = 0,
|
||||
kSrcOpenNI_PCL = 0,
|
||||
kSrcFreenect = 1,
|
||||
kSrcOpenNI_CV = 2,
|
||||
kSrcOpenNI_CV_ASUS = 3,
|
||||
kSrcOpenNI2 = 4,
|
||||
kSrcFreenect2 = 5,
|
||||
kSrcRealSense = 6,
|
||||
kSrcRGBDImages = 7,
|
||||
kSrcK4W2 = 8,
|
||||
kSrcRealSense2 = 9,
|
||||
kSrcK4A = 10,
|
||||
kSrcSeerSense = 11,
|
||||
|
||||
kSrcStereo = 100,
|
||||
kSrcDC1394 = 100,
|
||||
kSrcFlyCapture2 = 101,
|
||||
kSrcStereoImages = 102,
|
||||
kSrcStereoVideo = 103,
|
||||
kSrcStereoZed = 104,
|
||||
kSrcStereoUsb = 105,
|
||||
kSrcStereoTara = 106,
|
||||
kSrcStereoRealSense2 = 107,
|
||||
kSrcStereoMyntEye = 108,
|
||||
kSrcStereoZedOC = 109,
|
||||
kSrcStereoDepthAI = 110,
|
||||
|
||||
kSrcRGB = 200,
|
||||
kSrcUsbDevice = 200,
|
||||
kSrcImages = 201,
|
||||
kSrcVideo = 202,
|
||||
|
||||
kSrcDatabase = 300,
|
||||
|
||||
kSrcLidar = 400,
|
||||
kSrcLidarVLP16 = 400,
|
||||
};
|
||||
|
||||
public:
|
||||
PreferencesDialog(QWidget * parent = 0);
|
||||
virtual ~PreferencesDialog();
|
||||
|
||||
virtual QString getIniFilePath() const;
|
||||
virtual QString getTmpIniFilePath() const;
|
||||
void init(const QString & iniFilePath = "");
|
||||
void setCurrentPanelToSource();
|
||||
virtual QString getDefaultWorkingDirectory() const;
|
||||
|
||||
// save stuff
|
||||
void saveSettings();
|
||||
void saveWindowGeometry(const QWidget * window);
|
||||
void loadWindowGeometry(QWidget * window);
|
||||
void saveMainWindowState(const QMainWindow * mainWindow);
|
||||
void loadMainWindowState(QMainWindow * mainWindow, bool & maximized, bool & statusBarShown);
|
||||
void saveWidgetState(const QWidget * widget);
|
||||
void loadWidgetState(QWidget * widget);
|
||||
|
||||
void saveCustomConfig(const QString & section, const QString & key, const QString & value);
|
||||
QString loadCustomConfig(const QString & section, const QString & key);
|
||||
|
||||
rtabmap::ParametersMap getAllParameters() const;
|
||||
std::string getParameter(const std::string & key) const;
|
||||
void updateParameters(const ParametersMap & parameters, bool setOtherParametersToDefault = false);
|
||||
|
||||
//General panel
|
||||
int getGeneralLoggerLevel() const;
|
||||
int getGeneralLoggerEventLevel() const;
|
||||
int getGeneralLoggerPauseLevel() const;
|
||||
int getGeneralLoggerType() const;
|
||||
bool getGeneralLoggerPrintTime() const;
|
||||
bool getGeneralLoggerPrintThreadId() const;
|
||||
std::vector<std::string> getGeneralLoggerThreads() const;
|
||||
bool isVerticalLayoutUsed() const;
|
||||
bool imageRejectedShown() const;
|
||||
bool imageHighestHypShown() const;
|
||||
bool beepOnPause() const;
|
||||
bool isTimeUsedInFigures() const;
|
||||
bool isCacheSavedInFigures() const;
|
||||
bool notifyWhenNewGlobalPathIsReceived() const;
|
||||
int getOdomQualityWarnThr() const;
|
||||
bool isOdomOnlyInliersShown() const;
|
||||
bool isPosteriorGraphView() const;
|
||||
bool isWordsCountGraphView() const;
|
||||
bool isLocalizationsCountGraphView() const;
|
||||
bool isRelocalizationColorOdomCacheGraphView() const;
|
||||
int getOdomRegistrationApproach() const;
|
||||
double getOdomF2MGravitySigma() const;
|
||||
bool isOdomDisabled() const;
|
||||
bool isOdomSensorAsGt() const;
|
||||
bool isGroundTruthAligned() const;
|
||||
|
||||
bool isGraphsShown() const;
|
||||
bool isLabelsShown() const;
|
||||
bool isFramesShown() const;
|
||||
bool isLandmarksShown() const;
|
||||
double landmarkVisSize() const;
|
||||
bool isIMUGravityShown(int index) const;
|
||||
double getIMUGravityLength(int index) const;
|
||||
bool isIMUAccShown() const;
|
||||
bool isMarkerDetection() const;
|
||||
double getMarkerLength() const;
|
||||
double getVoxel() const;
|
||||
double getNoiseRadius() const;
|
||||
int getNoiseMinNeighbors() const;
|
||||
double getCeilingFilteringHeight() const;
|
||||
double getFloorFilteringHeight() const;
|
||||
int getNormalKSearch() const;
|
||||
double getNormalRadiusSearch() const;
|
||||
double getScanCeilingFilteringHeight() const;
|
||||
double getScanFloorFilteringHeight() const;
|
||||
int getScanNormalKSearch() const;
|
||||
double getScanNormalRadiusSearch() const;
|
||||
bool isCloudsShown(int index) const; // 0=map, 1=odom
|
||||
bool isOctomapUpdated() const;
|
||||
bool isOctomapShown() const;
|
||||
int getOctomapRenderingType() const;
|
||||
bool isOctomap2dGrid() const;
|
||||
int getOctomapTreeDepth() const;
|
||||
int getOctomapPointSize() const;
|
||||
int getCloudDecimation(int index) const; // 0=map, 1=odom
|
||||
double getCloudMaxDepth(int index) const; // 0=map, 1=odom
|
||||
double getCloudMinDepth(int index) const; // 0=map, 1=odom
|
||||
std::vector<float> getCloudRoiRatios(int index) const; // 0=map, 1=odom
|
||||
unsigned char getCloudConfidenceThr(int index) const; // 0=map, 1=odom
|
||||
int getCloudColorScheme(int index) const; // 0=map, 1=odom
|
||||
double getCloudOpacity(int index) const; // 0=map, 1=odom
|
||||
int getCloudPointSize(int index) const; // 0=map, 1=odom
|
||||
|
||||
bool isScansShown(int index) const; // 0=map, 1=odom
|
||||
int getDownsamplingStepScan(int index) const; // 0=map, 1=odom
|
||||
double getScanMaxRange(int index) const; // 0=map, 1=odom
|
||||
double getScanMinRange(int index) const; // 0=map, 1=odom
|
||||
double getCloudVoxelSizeScan(int index) const; // 0=map, 1=odom
|
||||
int getScanColorScheme(int index) const; // 0=map, 1=odom
|
||||
double getScanOpacity(int index) const; // 0=map, 1=odom
|
||||
int getScanPointSize(int index) const; // 0=map, 1=odom
|
||||
|
||||
bool isFeaturesShown(int index) const; // 0=map, 1=odom
|
||||
bool isFrustumsShown(int index) const; // 0=map, 1=odom
|
||||
int getFeaturesPointSize(int index) const; // 0=map, 1=odom
|
||||
|
||||
bool isCloudFiltering() const;
|
||||
bool isSubtractFiltering() const;
|
||||
double getCloudFilteringRadius() const;
|
||||
double getCloudFilteringAngle() const;
|
||||
int getSubtractFilteringMinPts() const;
|
||||
double getSubtractFilteringRadius() const;
|
||||
double getSubtractFilteringAngle() const;
|
||||
|
||||
double getGridUIResolution() const;
|
||||
bool getGridMapShown() const;
|
||||
int getElevationMapShown() const;
|
||||
int getGridMapSensor() const;
|
||||
bool projMapFrame() const;
|
||||
double projMaxGroundAngle() const;
|
||||
double projMaxGroundHeight() const;
|
||||
int projMinClusterSize() const;
|
||||
double projMaxObstaclesHeight() const;
|
||||
bool projFlatObstaclesDetected() const;
|
||||
double getGridMapOpacity() const;
|
||||
|
||||
bool isCloudMeshing() const;
|
||||
double getCloudMeshingAngle() const;
|
||||
bool isCloudMeshingQuad() const;
|
||||
bool isCloudMeshingTexture() const;
|
||||
int getCloudMeshingTriangleSize();
|
||||
|
||||
QString getWorkingDirectory() const;
|
||||
|
||||
// source panel
|
||||
double getGeneralInputRate() const;
|
||||
bool isSourceMirroring() const;
|
||||
PreferencesDialog::Src getSourceType() const;
|
||||
PreferencesDialog::Src getSourceDriver() const;
|
||||
QString getSourceDriverStr() const;
|
||||
QString getSourceDevice() const;
|
||||
PreferencesDialog::Src getLidarSourceDriver() const;
|
||||
PreferencesDialog::Src getOdomSourceDriver() const;
|
||||
|
||||
bool isSourceDatabaseStampsUsed() const;
|
||||
bool isSourceDatabaseStereoToDepth() const;
|
||||
bool isSourceRGBDColorOnly() const;
|
||||
int getIMUFilteringStrategy() const;
|
||||
bool getIMUFilteringBaseFrameConversion() const;
|
||||
bool isDepthFilteringAvailable() const;
|
||||
QString getSourceDistortionModel() const;
|
||||
bool isBilateralFiltering() const;
|
||||
double getBilateralSigmaS() const;
|
||||
double getBilateralSigmaR() const;
|
||||
int getSourceImageDecimation() const;
|
||||
int getSourceHistogramMethod() const;
|
||||
bool isSourceFeatureDetection() const;
|
||||
bool isSourceStereoDepthGenerated() const;
|
||||
bool isSourceStereoExposureCompensation() const;
|
||||
bool isRightGrayScale() const;
|
||||
bool isSourceScanFromDepth() const;
|
||||
bool isSourceScanDeskewing() const;
|
||||
int getSourceScanDownsampleStep() const;
|
||||
double getSourceScanRangeMin() const;
|
||||
double getSourceScanRangeMax() const;
|
||||
double getSourceScanVoxelSize() const;
|
||||
int getSourceScanNormalsK() const;
|
||||
double getSourceScanNormalsRadius() const;
|
||||
double getSourceScanForceGroundNormalsUp() const;
|
||||
Transform getSourceLocalTransform() const; //Openni group
|
||||
Transform getLaserLocalTransform() const; // directory images
|
||||
Transform getIMULocalTransform() const; // directory images
|
||||
QString getIMUPath() const;
|
||||
int getIMURate() const;
|
||||
Camera * createCamera(bool useRawImages = false, bool useColor = true); // return camera should be deleted if not null
|
||||
SensorCapture * createOdomSensor(Transform & extrinsics, double & timeOffset, float & scaleFactor, double & waitTime); // return odom sensor should be deleted if not null
|
||||
Lidar * createLidar(); // return lidar should be deleted if not null
|
||||
|
||||
int getIgnoredDCComponents() const;
|
||||
|
||||
//
|
||||
bool isImagesKept() const;
|
||||
bool isMissingCacheRepublished() const;
|
||||
bool isCloudsKept() const;
|
||||
float getTimeLimit() const;
|
||||
float getDetectionRate() const;
|
||||
bool isSLAMMode() const;
|
||||
bool isRGBDMode() const;
|
||||
int getKpMaxFeatures() const;
|
||||
bool isPriorIgnored() const;
|
||||
|
||||
//specific
|
||||
bool isStatisticsPublished() const;
|
||||
double getLoopThr() const;
|
||||
double getVpThr() const;
|
||||
double getSimThr() const;
|
||||
int getOdomStrategy() const;
|
||||
int getOdomBufferSize() const;
|
||||
QString getCameraInfoDir() const; // "workinfDir/camera_info"
|
||||
|
||||
//
|
||||
void setMonitoringState(bool monitoringState) {_monitoringState = monitoringState;}
|
||||
|
||||
Q_SIGNALS:
|
||||
void settingsChanged(PreferencesDialog::PANEL_FLAGS);
|
||||
void settingsChanged(rtabmap::ParametersMap);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setInputRate(double value);
|
||||
void setDetectionRate(double value);
|
||||
void setTimeLimit(float value);
|
||||
void setSLAMMode(bool enabled);
|
||||
void selectSourceDriver(Src src, int variant = 0);
|
||||
void calibrate();
|
||||
void calibrateSimple();
|
||||
void calibrateOdomSensorExtrinsics();
|
||||
void testLidar();
|
||||
|
||||
private Q_SLOTS:
|
||||
void closeDialog ( QAbstractButton * button );
|
||||
void resetApply ( QAbstractButton * button );
|
||||
void resetSettings(int panelNumber);
|
||||
void loadConfigFrom();
|
||||
bool saveConfigTo();
|
||||
void resetConfig();
|
||||
void loadPreset();
|
||||
void makeObsoleteGeneralPanel();
|
||||
void makeObsoleteCloudRenderingPanel();
|
||||
void makeObsoleteLoggingPanel();
|
||||
void makeObsoleteSourcePanel();
|
||||
void makeObsoleteCalibrationPanel();
|
||||
void clicked(const QModelIndex & current, const QModelIndex & previous);
|
||||
void addParameter(int value);
|
||||
void addParameter(bool value);
|
||||
void addParameter(double value);
|
||||
void addParameter(const QString & value);
|
||||
void updatePredictionPlot();
|
||||
void updateKpROI();
|
||||
void updateStereoDisparityVisibility();
|
||||
void updateFeatureMatchingVisibility();
|
||||
void updateGlobalDescriptorVisibility();
|
||||
void updateOdometryStackedIndex(int index);
|
||||
void useOdomFeatures();
|
||||
void changeWorkingDirectory();
|
||||
void changeDictionaryPath();
|
||||
void changeOdometryORBSLAMVocabulary();
|
||||
void changeOdometryOKVISConfigPath();
|
||||
void changeOdometryVINSConfigPath();
|
||||
void changeOdometryOpenVINSLeftMask();
|
||||
void changeOdometryOpenVINSRightMask();
|
||||
void changeIcpPMConfigPath();
|
||||
void changeSuperPointModelPath();
|
||||
void changePyMatcherPath();
|
||||
void changePyMatcherModel();
|
||||
void changePyDescriptorPath();
|
||||
void changePyDetectorPath();
|
||||
void readSettingsEnd();
|
||||
void setupTreeView();
|
||||
void updateBasicParameter();
|
||||
void openDatabaseViewer();
|
||||
void visualizeDistortionModel();
|
||||
void selectSourceDatabase();
|
||||
void selectCalibrationPath();
|
||||
void selectOdomSensorCalibrationPath();
|
||||
void selectSourceImagesStamps();
|
||||
void selectSourceRGBDImagesPathRGB();
|
||||
void selectSourceRGBDImagesPathDepth();
|
||||
void selectSourceImagesPathScans();
|
||||
void selectSourceImagesPathIMU();
|
||||
void selectSourceImagesPathOdom();
|
||||
void selectSourceImagesPathGt();
|
||||
void selectSourceStereoImagesPathLeft();
|
||||
void selectSourceStereoImagesPathRight();
|
||||
void selectSourceImagesPath();
|
||||
void selectSourceVideoPath();
|
||||
void selectSourceStereoVideoPath();
|
||||
void selectSourceStereoVideoPath2();
|
||||
void selectSourceDistortionModel();
|
||||
void selectSourceOniPath();
|
||||
void selectSourceOni2Path();
|
||||
void selectSourceMKVPath();
|
||||
void selectSourceSvoPath();
|
||||
void selectSourceRealsense2JsonPath();
|
||||
void selectSourceDepthaiBlobPath();
|
||||
void selectVlp16PcapPath();
|
||||
void updateSourceGrpVisibility();
|
||||
void testOdometry();
|
||||
void testCamera();
|
||||
|
||||
protected:
|
||||
virtual void showEvent ( QShowEvent * event );
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
|
||||
virtual QString getParamMessage();
|
||||
|
||||
virtual void readGuiSettings(const QString & filePath = QString());
|
||||
virtual void readCameraSettings(const QString & filePath = QString());
|
||||
virtual bool readCoreSettings(const QString & filePath = QString());
|
||||
|
||||
virtual void writeGuiSettings(const QString & filePath = QString()) const;
|
||||
virtual void writeCameraSettings(const QString & filePath = QString()) const;
|
||||
virtual void writeCoreSettings(const QString & filePath = QString()) const;
|
||||
|
||||
void setParameter(const std::string & key, const std::string & value);
|
||||
|
||||
private:
|
||||
void readSettings(const QString & filePath = QString());
|
||||
void writeSettings(const QString & filePath = QString());
|
||||
bool validateForm();
|
||||
void setupSignals();
|
||||
void setupKpRoiPanel();
|
||||
bool parseModel(QList<QGroupBox*> & boxes, QStandardItem * parentItem, int currentLevel, int & absoluteIndex);
|
||||
void resetSettings(QGroupBox * groupBox);
|
||||
void loadPreset(const std::string & presetHexHeader);
|
||||
void addParameter(const QObject * object, int value);
|
||||
void addParameter(const QObject * object, bool value);
|
||||
void addParameter(const QObject * object, double value);
|
||||
void addParameter(const QObject * object, const QString & value);
|
||||
void addParameters(const QObjectList & children);
|
||||
void addParameters(const QStackedWidget * stackedWidget, int panel = -1);
|
||||
void addParameters(const QGroupBox * box);
|
||||
QList<QGroupBox*> getGroupBoxes();
|
||||
void readSettingsBegin();
|
||||
Camera * createCamera(Src driver, const QString & device, const QString & calibrationPath, bool useRawImages, bool useColor, bool odomOnly, bool odomSensorExtrinsicsCalib); // return camera should be deleted if not null
|
||||
|
||||
protected:
|
||||
PANEL_FLAGS _obsoletePanels;
|
||||
|
||||
private:
|
||||
rtabmap::ParametersMap _modifiedParameters;
|
||||
rtabmap::ParametersMap _parameters;
|
||||
Ui_preferencesDialog * _ui;
|
||||
QStandardItemModel * _indexModel;
|
||||
bool _initialized;
|
||||
bool _monitoringState;
|
||||
|
||||
QProgressDialog * _progressDialog;
|
||||
|
||||
//calibration
|
||||
CalibrationDialog * _calibrationDialog;
|
||||
CreateSimpleCalibrationDialog * _createCalibrationDialog;
|
||||
|
||||
QVector<QCheckBox*> _3dRenderingShowClouds;
|
||||
QVector<QSpinBox*> _3dRenderingDecimation;
|
||||
QVector<QDoubleSpinBox*> _3dRenderingMaxDepth;
|
||||
QVector<QDoubleSpinBox*> _3dRenderingMinDepth;
|
||||
QVector<QLineEdit*> _3dRenderingRoiRatios;
|
||||
QVector<QSpinBox*> _3dRenderingDepthConfidenceThr;
|
||||
QVector<QSpinBox*> _3dRenderingColorScheme;
|
||||
QVector<QDoubleSpinBox*> _3dRenderingOpacity;
|
||||
QVector<QSpinBox*> _3dRenderingPtSize;
|
||||
QVector<QCheckBox*> _3dRenderingShowScans;
|
||||
QVector<QSpinBox*> _3dRenderingDownsamplingScan;
|
||||
QVector<QDoubleSpinBox*> _3dRenderingMaxRange;
|
||||
QVector<QDoubleSpinBox*> _3dRenderingMinRange;
|
||||
QVector<QDoubleSpinBox*> _3dRenderingVoxelSizeScan;
|
||||
QVector<QSpinBox*> _3dRenderingColorSchemeScan;
|
||||
QVector<QDoubleSpinBox*> _3dRenderingOpacityScan;
|
||||
QVector<QSpinBox*> _3dRenderingPtSizeScan;
|
||||
QVector<QCheckBox*> _3dRenderingShowFeatures;
|
||||
QVector<QCheckBox*> _3dRenderingShowFrustums;
|
||||
QVector<QSpinBox*> _3dRenderingPtSizeFeatures;
|
||||
QVector<QCheckBox*> _3dRenderingGravity;
|
||||
QVector<QDoubleSpinBox*> _3dRenderingGravityLength;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(PreferencesDialog::PANEL_FLAGS)
|
||||
|
||||
}
|
||||
|
||||
#endif /* PREFERENCESDIALOG_H_ */
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_PROGRESSDIALOG_H_
|
||||
#define RTABMAP_PROGRESSDIALOG_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QLabel;
|
||||
class QTextEdit;
|
||||
class QProgressBar;
|
||||
class QPushButton;
|
||||
class QCheckBox;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT ProgressDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ProgressDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
virtual ~ProgressDialog();
|
||||
|
||||
void setEndMessage(const QString & message) {_endMessage = message;} // Message shown when the progress is finished
|
||||
void setValue(int value);
|
||||
int maximumSteps() const;
|
||||
void setMaximumSteps(int steps);
|
||||
void setAutoClose(bool on, int delayedClosingTimeSec = -1);
|
||||
void setCancelButtonVisible(bool visible);
|
||||
bool isCanceled() const {return _canceled;}
|
||||
|
||||
Q_SIGNALS:
|
||||
void canceled();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * event);
|
||||
|
||||
public Q_SLOTS:
|
||||
void appendText(const QString & text ,const QColor & color = Qt::black);
|
||||
void incrementStep(int steps = 1);
|
||||
void clear();
|
||||
void resetProgress();
|
||||
|
||||
private Q_SLOTS:
|
||||
void closeDialog();
|
||||
void cancel();
|
||||
|
||||
private:
|
||||
QLabel * _text;
|
||||
QTextEdit * _detailedText;
|
||||
QProgressBar * _progressBar;
|
||||
QPushButton * _closeButton;
|
||||
QPushButton * _cancelButton;
|
||||
QCheckBox * _closeWhenDoneCheckBox;
|
||||
QString _endMessage;
|
||||
int _delayedClosingTime; // sec
|
||||
bool _canceled;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* PROGRESSDIALOG_H_ */
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
Copyright (c) 2010-2017, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_RECOVERYSTATE_H_
|
||||
#define RTABMAP_RECOVERYSTATE_H_
|
||||
|
||||
#include "rtabmap/gui/ProgressDialog.h"
|
||||
#include "rtabmap/core/ProgressState.h"
|
||||
#include "rtabmap/utilite/UStl.h"
|
||||
#include "rtabmap/utilite/UConversion.h"
|
||||
#include <QApplication>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RecoveryState : public QObject, public ProgressState
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RecoveryState(ProgressDialog * dialog): dialog_(dialog)
|
||||
{
|
||||
connect(dialog_, SIGNAL(canceled()), this, SLOT(cancel()));
|
||||
}
|
||||
virtual ~RecoveryState() {}
|
||||
virtual bool callback(const std::string & msg) const
|
||||
{
|
||||
if(!msg.empty())
|
||||
{
|
||||
QString msgQt = msg.c_str();
|
||||
if(msgQt.contains("Processed"))
|
||||
{
|
||||
dialog_->incrementStep();
|
||||
dialog_->appendText(msg.c_str());
|
||||
}
|
||||
else if(msgQt.contains("Found"))
|
||||
{
|
||||
std::list<std::string> strSplit = uSplitNumChar(msg);
|
||||
if(strSplit.size() == 3)
|
||||
{
|
||||
int nodes = uStr2Int(*(++strSplit.begin()));
|
||||
if(nodes > 0)
|
||||
{
|
||||
dialog_->setMaximumSteps(nodes);
|
||||
}
|
||||
}
|
||||
dialog_->appendText(msg.c_str());
|
||||
}
|
||||
else if(msgQt.contains("Skipping") ||
|
||||
msgQt.contains("Failed processing"))
|
||||
{
|
||||
dialog_->appendText(msg.c_str(), Qt::darkYellow);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog_->appendText(msg.c_str());
|
||||
}
|
||||
}
|
||||
QApplication::processEvents();
|
||||
if(!isCanceled())
|
||||
{
|
||||
return ProgressState::callback(msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void cancel()
|
||||
{
|
||||
setCanceled(true);
|
||||
}
|
||||
|
||||
private:
|
||||
ProgressDialog * dialog_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* RECOVERYSTATE_H_ */
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RTABMAP_STATSTOOLBOX_H_
|
||||
#define RTABMAP_STATSTOOLBOX_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtCore/QMap>
|
||||
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
class QMenu;
|
||||
class QGridLayout;
|
||||
class QToolBox;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAP_GUI_EXPORT StatItem : public QWidget
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
StatItem(const QString & name, bool cacheOn, const std::vector<qreal> & x, const std::vector<qreal> & y, const QString & unit = QString(), const QMenu * menu = 0, QGridLayout * grid = 0, QWidget * parent = 0);
|
||||
virtual ~StatItem();
|
||||
void addValue(qreal y);
|
||||
void addValue(qreal x, qreal y);
|
||||
void setValues(const std::vector<qreal> & x, const std::vector<qreal> & y);
|
||||
QString value() const;
|
||||
std::vector<qreal> xValues() const {return _x;}
|
||||
std::vector<qreal> yValues() const {return _y;}
|
||||
void setCacheOn(bool on);
|
||||
void clearCache();
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateMenu(const QMenu * menu);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueAdded(qreal);
|
||||
void valueAdded(qreal, qreal);
|
||||
void valuesChanged(const std::vector<qreal> &, const std::vector<qreal> &);
|
||||
void plotRequested(const StatItem *, const QString &);
|
||||
|
||||
private Q_SLOTS:
|
||||
void preparePlotRequest();
|
||||
|
||||
private:
|
||||
void setupUi(QGridLayout * grid);
|
||||
|
||||
private:
|
||||
QToolButton * _button;
|
||||
QLabel * _name;
|
||||
QLabel * _value;
|
||||
QLabel * _unit;
|
||||
QMenu * _menu;
|
||||
|
||||
bool _cacheOn;
|
||||
std::vector<qreal> _x;
|
||||
std::vector<qreal> _y;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class RTABMAP_GUI_EXPORT StatsToolBox : public QWidget
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
StatsToolBox(QWidget * parent);
|
||||
virtual ~StatsToolBox();
|
||||
|
||||
void getFiguresSetup(QList<int> & curvesPerFigure, QStringList & curveNames, QStringList & curveThresholds);
|
||||
void addCurve(const QString & name, bool newFigure = true, bool cacheOn = false);
|
||||
void addThreshold(const QString & name, qreal value); // Add to latest figure
|
||||
void setWorkingDirectory(const QString & workingDirectory);
|
||||
void setNewFigureMaxItems(int value) {_newFigureMaxItems = value;}
|
||||
void closeFigures();
|
||||
void setCacheOn(bool on);
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateStat(const QString & statFullName, bool cacheOn);
|
||||
void updateStat(const QString & statFullName, qreal y, bool cacheOn);
|
||||
void updateStat(const QString & statFullName, qreal x, qreal y, bool cacheOn);
|
||||
void updateStat(const QString & statFullName, const std::vector<qreal> & x, const std::vector<qreal> & y, bool cacheOn);
|
||||
void clear();
|
||||
|
||||
Q_SIGNALS:
|
||||
void menuChanged(const QMenu *);
|
||||
void figuresSetupChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void plot(const StatItem * stat, const QString & plotName = QString());
|
||||
void figureDeleted(QObject * obj);
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent * event);
|
||||
|
||||
private:
|
||||
QMenu * _plotMenu;
|
||||
QToolBox * _statBox;
|
||||
QString _workingDirectory;
|
||||
int _newFigureMaxItems;
|
||||
QMap<QString, QWidget*> _figures;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* STATSTOOLBOX_H_ */
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright (c) 2010-2016, 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
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RTABMAP_TEXTURINGSTATE_H_
|
||||
#define RTABMAP_TEXTURINGSTATE_H_
|
||||
|
||||
#include "rtabmap/gui/ProgressDialog.h"
|
||||
#include "rtabmap/core/ProgressState.h"
|
||||
#include <QApplication>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class TexturingState : public QObject, public ProgressState
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TexturingState(ProgressDialog * dialog, bool incrementOnMsgReceived): dialog_(dialog)
|
||||
{
|
||||
_increment = incrementOnMsgReceived;
|
||||
connect(dialog_, SIGNAL(canceled()), this, SLOT(cancel()));
|
||||
}
|
||||
virtual ~TexturingState() {}
|
||||
virtual bool callback(const std::string & msg) const
|
||||
{
|
||||
if(!msg.empty())
|
||||
{
|
||||
dialog_->appendText(msg.c_str());
|
||||
if(_increment)
|
||||
{
|
||||
dialog_->incrementStep();
|
||||
}
|
||||
}
|
||||
QApplication::processEvents();
|
||||
if(!isCanceled())
|
||||
{
|
||||
return ProgressState::callback(msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void cancel()
|
||||
{
|
||||
setCanceled(true);
|
||||
}
|
||||
|
||||
private:
|
||||
ProgressDialog * dialog_;
|
||||
bool _increment;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* GUILIB_SRC_TEXTURINGSTATE_H_ */
|
||||
@@ -0,0 +1,303 @@
|
||||
/*
|
||||
* utilite is a cross-platform library with
|
||||
* useful utilities for fast and small developing.
|
||||
* Copyright (C) 2010 Mathieu Labbe
|
||||
*
|
||||
* utilite is free library: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* utilite 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UCV2QT_H_
|
||||
#define UCV2QT_H_
|
||||
|
||||
#include <QtGui/QImage>
|
||||
#include <QtGui/QColor>
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <rtabmap/utilite/UMath.h>
|
||||
#include <rtabmap/utilite/UThread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
enum uCvQtDepthColorMap{
|
||||
uCvQtDepthWhiteToBlack,
|
||||
uCvQtDepthBlackToWhite,
|
||||
uCvQtDepthRedToBlue,
|
||||
uCvQtDepthBlueToRed
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert a cv::Mat image to a QImage. Support
|
||||
* depth (float32, uint16) image and RGB/BGR 8bits images.
|
||||
* @param image the cv::Mat image (can be 1 channel [CV_8U, CV_16U or CV_32F] or 3 channels [CV_U8])
|
||||
* @param isBgr if 3 channels, it is BGR or RGB order.
|
||||
* @param colorMap gradient of color to use to visualize depth or monochrome images
|
||||
* @param depthMin fixed minimum range (m) of the depth gradient (if depthMax<=depthMin, max/min are computed based on data in depth image)
|
||||
* @param depthMax fixed maximum range (m) of the depth gradient (if depthMax<=depthMin, max/min are computed based on data in depth image)
|
||||
* @return the QImage
|
||||
*/
|
||||
inline QImage uCvMat2QImage(
|
||||
const cv::Mat & image,
|
||||
bool isBgr = true,
|
||||
uCvQtDepthColorMap colorMap = uCvQtDepthBlackToWhite,
|
||||
float depthMin = 0,
|
||||
float depthMax = 0)
|
||||
{
|
||||
QImage qtemp;
|
||||
if(!image.empty() && image.depth() == CV_8U)
|
||||
{
|
||||
if(image.channels()==3)
|
||||
{
|
||||
const unsigned char * data = image.data;
|
||||
if(image.channels() == 3)
|
||||
{
|
||||
qtemp = QImage(image.cols, image.rows, QImage::Format_RGB32);
|
||||
for(int y = 0; y < image.rows; ++y, data += image.cols*image.elemSize())
|
||||
{
|
||||
for(int x = 0; x < image.cols; ++x)
|
||||
{
|
||||
QRgb * p = ((QRgb*)qtemp.scanLine (y)) + x;
|
||||
if(isBgr)
|
||||
{
|
||||
*p = qRgb(data[x * image.channels()+2], data[x * image.channels()+1], data[x * image.channels()]);
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = qRgb(data[x * image.channels()], data[x * image.channels()+1], data[x * image.channels()+2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(image.channels() == 1)
|
||||
{
|
||||
// mono grayscale
|
||||
qtemp = QImage(image.data, image.cols, image.rows, image.cols, QImage::Format_Indexed8).copy();
|
||||
|
||||
QVector<QRgb> my_table;
|
||||
my_table.reserve(256);
|
||||
if(colorMap == uCvQtDepthRedToBlue || colorMap == uCvQtDepthBlueToRed)
|
||||
{
|
||||
if(colorMap == uCvQtDepthBlueToRed) {
|
||||
for(int i = 0; i < 256; i++)
|
||||
my_table.push_back(QColor::fromHsv(255-i, 255, 255, 255).rgb());
|
||||
}
|
||||
else {
|
||||
for(int i = 0; i < 256; i++)
|
||||
my_table.push_back(QColor::fromHsv(i, 255, 255, 255).rgb());
|
||||
}
|
||||
}
|
||||
else if(colorMap == uCvQtDepthBlackToWhite)
|
||||
{
|
||||
for(int i = 0; i < 256; i++)
|
||||
my_table.push_back(qRgb(i,i,i));
|
||||
}
|
||||
else // uCvQtDepthWhiteToBlack
|
||||
{
|
||||
for(int i = 0; i < 256; i++)
|
||||
my_table.push_back(qRgb(255-i,255-i,255-i));
|
||||
}
|
||||
qtemp.setColorTable(my_table);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Wrong image format, must have 1 or 3 channels\n");
|
||||
}
|
||||
}
|
||||
else if(image.depth() == CV_32F && image.channels()==1)
|
||||
{
|
||||
// Assume depth image (float in meters)
|
||||
const float * data = (const float *)image.data;
|
||||
float min,max;
|
||||
if(depthMax>depthMin)
|
||||
{
|
||||
min = depthMin;
|
||||
max = depthMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
min = max = data[0];
|
||||
for(unsigned int i=1; i<image.total(); ++i)
|
||||
{
|
||||
if(uIsFinite(data[i]) && data[i] > 0)
|
||||
{
|
||||
if(!uIsFinite(min) || (data[i] > 0 && data[i]<min))
|
||||
{
|
||||
min = data[i];
|
||||
}
|
||||
if(!uIsFinite(max) || (data[i] > 0 && data[i]>max))
|
||||
{
|
||||
max = data[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if(depthMax > 0 && depthMax > depthMin)
|
||||
{
|
||||
max = depthMax;
|
||||
}
|
||||
if(depthMin>0 && (depthMin < depthMax || depthMin < max))
|
||||
{
|
||||
min = depthMin;
|
||||
}
|
||||
}
|
||||
|
||||
qtemp = QImage(image.cols, image.rows, QImage::Format_Indexed8);
|
||||
for(int y = 0; y < image.rows; ++y, data += image.cols)
|
||||
{
|
||||
for(int x = 0; x < image.cols; ++x)
|
||||
{
|
||||
uchar * p = qtemp.scanLine (y) + x;
|
||||
if(!uIsFinite(data[x]) || max == min || data[x] == 0)
|
||||
{
|
||||
*p = 0;
|
||||
}
|
||||
else if(data[x] < min)
|
||||
{
|
||||
*p = 255;
|
||||
}
|
||||
else if(data[x] > max)
|
||||
{
|
||||
*p=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = uchar(std::max(1.0f, std::min(255.0f, 255.0f - ((data[x]-min)*255.0f)/(max-min))));
|
||||
}
|
||||
if(*p!=0 && (colorMap == uCvQtDepthBlackToWhite || colorMap == uCvQtDepthRedToBlue))
|
||||
{
|
||||
*p = 255-*p+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QRgb> my_table;
|
||||
my_table.reserve(256);
|
||||
if(colorMap == uCvQtDepthRedToBlue || colorMap == uCvQtDepthBlueToRed)
|
||||
{
|
||||
my_table.push_back(qRgb(0,0,0));
|
||||
for(int i = 1; i < 256; i++)
|
||||
my_table.push_back(QColor::fromHsv(i, 255, 255, 255).rgb());
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 0; i < 256; i++)
|
||||
my_table.push_back(qRgb(i,i,i));
|
||||
}
|
||||
qtemp.setColorTable(my_table);
|
||||
}
|
||||
else if(image.depth() == CV_16U && image.channels()==1)
|
||||
{
|
||||
// Assume depth image (unsigned short in mm)
|
||||
const unsigned short * data = (const unsigned short *)image.data;
|
||||
unsigned short min,max;
|
||||
if(depthMax>depthMin)
|
||||
{
|
||||
min = depthMin*1000;
|
||||
max = depthMax*1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
min = max = data[0];
|
||||
for(unsigned int i=1; i<image.total(); ++i)
|
||||
{
|
||||
if(uIsFinite(data[i]) && data[i] > 0)
|
||||
{
|
||||
if(!uIsFinite(min) || (data[i] > 0 && data[i]<min))
|
||||
{
|
||||
min = data[i];
|
||||
}
|
||||
if(!uIsFinite(max) || (data[i] > 0 && data[i]>max))
|
||||
{
|
||||
max = data[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if(depthMax > 0 && depthMax > depthMin)
|
||||
{
|
||||
max = depthMax*1000;
|
||||
}
|
||||
if(depthMin>0 && (depthMin < depthMax || depthMin*1000 < max))
|
||||
{
|
||||
min = depthMin*1000;
|
||||
}
|
||||
}
|
||||
|
||||
qtemp = QImage(image.cols, image.rows, QImage::Format_Indexed8);
|
||||
for(int y = 0; y < image.rows; ++y, data += image.cols)
|
||||
{
|
||||
for(int x = 0; x < image.cols; ++x)
|
||||
{
|
||||
uchar * p = qtemp.scanLine (y) + x;
|
||||
if(!uIsFinite(data[x]) || max == min || data[x]==0)
|
||||
{
|
||||
*p = 0;
|
||||
}
|
||||
else if(data[x] < min)
|
||||
{
|
||||
*p = 255;
|
||||
}
|
||||
else if(data[x] > max)
|
||||
{
|
||||
*p = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = uchar(std::max(1.0f, std::min(255.0f, 255.0f - (float(data[x]-min)/float(max-min))*255.0f)));
|
||||
}
|
||||
if(*p!=0 && (colorMap == uCvQtDepthBlackToWhite || colorMap == uCvQtDepthRedToBlue))
|
||||
{
|
||||
*p = 255-*p+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QRgb> my_table;
|
||||
my_table.reserve(256);
|
||||
if(colorMap == uCvQtDepthRedToBlue || colorMap == uCvQtDepthBlueToRed)
|
||||
{
|
||||
my_table.push_back(qRgb(0,0,0));
|
||||
for(int i = 1; i < 256; i++)
|
||||
my_table.push_back(QColor::fromHsv(i, 255, 255, 255).rgb());
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 0; i < 256; i++)
|
||||
my_table.push_back(qRgb(i,i,i));
|
||||
}
|
||||
qtemp.setColorTable(my_table);
|
||||
}
|
||||
else if(!image.empty() && image.depth() != CV_8U)
|
||||
{
|
||||
printf("Wrong image format, must be 8_bits/3channels or (depth) 32bitsFloat/1channel, 16bits/1channel\n");
|
||||
}
|
||||
return qtemp;
|
||||
}
|
||||
|
||||
class UCvMat2QImageThread : public UThread
|
||||
{
|
||||
public:
|
||||
UCvMat2QImageThread(const cv::Mat & image, bool isBgr = true) :
|
||||
image_(image),
|
||||
isBgr_(isBgr) {}
|
||||
QImage & getQImage() {return qtImage_;}
|
||||
protected:
|
||||
virtual void mainLoop()
|
||||
{
|
||||
qtImage_ = uCvMat2QImage(image_, isBgr_);
|
||||
this->kill();
|
||||
}
|
||||
private:
|
||||
cv::Mat image_;
|
||||
bool isBgr_;
|
||||
QImage qtImage_;
|
||||
};
|
||||
|
||||
#endif /* UCV2QT_H_ */
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* ImageView.h
|
||||
*
|
||||
* Created on: 2012-06-20
|
||||
* Author: mathieu
|
||||
*/
|
||||
|
||||
#ifndef IMAGEVIEW_H_
|
||||
#define IMAGEVIEW_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
class RTABMAP_GUI_EXPORT UImageView : public QWidget
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
UImageView(QWidget * parent = 0) : QWidget(parent) {}
|
||||
~UImageView() {}
|
||||
void setBackgroundBrush(const QBrush & brush) {brush_ = brush;}
|
||||
|
||||
public Q_SLOTS:
|
||||
void setImage(const QImage & image)
|
||||
{
|
||||
pixmap_ = QPixmap::fromImage(image);
|
||||
this->update();
|
||||
}
|
||||
|
||||
private:
|
||||
void computeScaleOffsets(float & scale, float & offsetX, float & offsetY)
|
||||
{
|
||||
scale = 1.0f;
|
||||
offsetX = 0.0f;
|
||||
offsetY = 0.0f;
|
||||
|
||||
if(!pixmap_.isNull())
|
||||
{
|
||||
float w = pixmap_.width();
|
||||
float h = pixmap_.height();
|
||||
float widthRatio = float(this->rect().width()) / w;
|
||||
float heightRatio = float(this->rect().height()) / h;
|
||||
|
||||
if(widthRatio < heightRatio)
|
||||
{
|
||||
scale = widthRatio;
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = heightRatio;
|
||||
}
|
||||
|
||||
w *= scale;
|
||||
h *= scale;
|
||||
|
||||
if(w < this->rect().width())
|
||||
{
|
||||
offsetX = (this->rect().width() - w)/2.0f;
|
||||
}
|
||||
if(h < this->rect().height())
|
||||
{
|
||||
offsetY = (this->rect().height() - h)/2.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
//Draw background
|
||||
painter.save();
|
||||
painter.setBrush(brush_);
|
||||
painter.drawRect(this->rect());
|
||||
painter.restore();
|
||||
|
||||
if(!pixmap_.isNull())
|
||||
{
|
||||
painter.save();
|
||||
//Scale
|
||||
float ratio, offsetX, offsetY;
|
||||
this->computeScaleOffsets(ratio, offsetX, offsetY);
|
||||
painter.translate(offsetX, offsetY);
|
||||
painter.scale(ratio, ratio);
|
||||
painter.drawPixmap(QPoint(0,0), pixmap_);
|
||||
painter.restore();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QPixmap pixmap_;
|
||||
QBrush brush_;
|
||||
};
|
||||
|
||||
|
||||
#endif /* IMAGEVIEW_H_ */
|
||||
@@ -0,0 +1,644 @@
|
||||
/*
|
||||
* utilite is a cross-platform library with
|
||||
* useful utilities for fast and small developing.
|
||||
* Copyright (C) 2010 Mathieu Labbe
|
||||
*
|
||||
* utilite is free library: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* utilite 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UPLOT_H_
|
||||
#define UPLOT_H_
|
||||
|
||||
#include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
|
||||
|
||||
#include <QFrame>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtGui/QPen>
|
||||
#include <QtGui/QBrush>
|
||||
#include <QGraphicsEllipseItem>
|
||||
#include <QtCore/QMutex>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QtCore/QTime>
|
||||
#include <QtCore/QElapsedTimer>
|
||||
|
||||
class QGraphicsView;
|
||||
class QGraphicsScene;
|
||||
class QGraphicsItem;
|
||||
class QFormLayout;
|
||||
class QScrollArea;
|
||||
|
||||
/**
|
||||
* UPlotItem is a QGraphicsEllipseItem and can be inherited to do custom behaviors
|
||||
* on an hoverEnterEvent() for example.
|
||||
*/
|
||||
class RTABMAP_GUI_EXPORT UPlotItem : public QGraphicsEllipseItem
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor 1.
|
||||
*/
|
||||
UPlotItem(qreal dataX, qreal dataY, qreal width=2);
|
||||
/**
|
||||
* Constructor 2.
|
||||
*/
|
||||
UPlotItem(const QPointF & data, qreal width=2);
|
||||
virtual ~UPlotItem();
|
||||
|
||||
public:
|
||||
void setNextItem(UPlotItem * nextItem);
|
||||
void setPreviousItem(UPlotItem * previousItem);
|
||||
void setData(const QPointF & data);
|
||||
|
||||
UPlotItem * nextItem() const {return _nextItem;}
|
||||
UPlotItem * 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:
|
||||
void init(qreal dataX, qreal dataY);
|
||||
|
||||
private:
|
||||
QPointF _data;
|
||||
UPlotItem * _previousItem;
|
||||
UPlotItem * _nextItem;
|
||||
QGraphicsTextItem * _text;
|
||||
QGraphicsRectItem * _textBackground;
|
||||
};
|
||||
|
||||
class UPlot;
|
||||
|
||||
/**
|
||||
* UPlotCurve is a curve used to hold data shown in a UPlot.
|
||||
*/
|
||||
class RTABMAP_GUI_EXPORT UPlotCurve : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor 1
|
||||
*/
|
||||
UPlotCurve(const QString & name, QObject * parent = 0);
|
||||
/**
|
||||
* Constructor 2
|
||||
*/
|
||||
UPlotCurve(const QString & name, const QVector<UPlotItem *> data, QObject * parent = 0);
|
||||
/**
|
||||
* Constructor 3
|
||||
*/
|
||||
UPlotCurve(const QString & name, const QVector<qreal> & x, const QVector<qreal> & y, QObject * parent = 0);
|
||||
virtual ~UPlotCurve();
|
||||
|
||||
/**
|
||||
* Get pen.
|
||||
*/
|
||||
const QPen & pen() const {return _pen;}
|
||||
/**
|
||||
* Get brush.
|
||||
*/
|
||||
const QBrush & brush() const {return _brush;}
|
||||
|
||||
/**
|
||||
* Set pen.
|
||||
*/
|
||||
void setPen(const QPen & pen);
|
||||
/**
|
||||
* Set brush.
|
||||
*/
|
||||
void setBrush(const QBrush & brush);
|
||||
|
||||
void setItemsColor(const QColor & color);
|
||||
QColor itemsColor() const {return _itemsColor;}
|
||||
|
||||
/**
|
||||
* Get name.
|
||||
*/
|
||||
QString name() const {return _name;}
|
||||
/**
|
||||
* Get the number of items in the curve (dot + line items).
|
||||
*/
|
||||
int itemsSize() const;
|
||||
QPointF getItemData(int index);
|
||||
bool isVisible() const {return _visible;}
|
||||
void setData(QVector<UPlotItem*> & data); // take the ownership
|
||||
void getData(QVector<qreal> & x, QVector<qreal> & y) const; // only call in Qt MainThread
|
||||
void getData(QMap<qreal,qreal> & data) const; // only call in Qt MainThread
|
||||
void draw(QPainter * painter, const QRect & limits);
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
*
|
||||
* Clear curve's values.
|
||||
*/
|
||||
virtual void clear();
|
||||
/**
|
||||
*
|
||||
* Show or hide the curve.
|
||||
*/
|
||||
void setVisible(bool visible);
|
||||
/**
|
||||
*
|
||||
* Set increment of the x values (when auto-increment is used).
|
||||
*/
|
||||
void setXIncrement(qreal increment);
|
||||
/**
|
||||
*
|
||||
* Set starting x value (when auto-increment is used).
|
||||
*/
|
||||
void setXStart(qreal val);
|
||||
/**
|
||||
*
|
||||
* Add a single value, using a custom UPlotItem.
|
||||
*/
|
||||
void addValue(UPlotItem * data); // take the ownership
|
||||
/**
|
||||
*
|
||||
* Add a single value y, x is auto-incremented by the increment set with setXIncrement().
|
||||
* @see setXStart()
|
||||
*/
|
||||
void addValue(qreal y);
|
||||
/**
|
||||
*
|
||||
* Add a single value y at x.
|
||||
*/
|
||||
void addValue(qreal x, qreal y);
|
||||
/**
|
||||
*
|
||||
* For convenience...
|
||||
* Add a single value y, x is auto-incremented by the increment set with setXIncrement().
|
||||
* @see setXStart()
|
||||
*/
|
||||
void addValue(const QString & y);
|
||||
/**
|
||||
*
|
||||
* For convenience...
|
||||
* Add multiple values, using custom UPlotItem.
|
||||
*/
|
||||
void addValues(QVector<UPlotItem *> & data); // take the ownership
|
||||
/**
|
||||
*
|
||||
* Add multiple values y at x. Vectors must have the same size.
|
||||
*/
|
||||
void addValues(const QVector<qreal> & xs, const QVector<qreal> & ys);
|
||||
/**
|
||||
*
|
||||
* Add multiple values y, x is auto-incremented by the increment set with setXIncrement().
|
||||
* @see setXStart()
|
||||
*/
|
||||
void addValues(const QVector<qreal> & ys);
|
||||
void addValues(const QVector<int> & ys); // for convenience
|
||||
/**
|
||||
*
|
||||
* Add multiple values y, x is auto-incremented by the increment set with setXIncrement().
|
||||
* @see setXStart()
|
||||
*/
|
||||
void addValues(const std::vector<qreal> & ys); // for convenience
|
||||
void addValues(const std::vector<int> & ys); // for convenience
|
||||
|
||||
void setData(const QVector<qreal> & x, const QVector<qreal> & y);
|
||||
void setData(const std::vector<qreal> & x, const std::vector<qreal> & y);
|
||||
void setData(const QVector<qreal> & y);
|
||||
void setData(const std::vector<qreal> & y);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
*
|
||||
* emitted when data is changed.
|
||||
*/
|
||||
void dataChanged(const UPlotCurve *);
|
||||
|
||||
protected:
|
||||
friend class UPlot;
|
||||
void attach(UPlot * plot);
|
||||
void detach(UPlot * plot);
|
||||
void updateMinMax();
|
||||
const QVector<qreal> & getMinMax() const {return _minMax;}
|
||||
int removeItem(int index);
|
||||
void _addValue(UPlotItem * data);;
|
||||
virtual bool isMinMaxValid() const {return _minMax.size();}
|
||||
virtual void update(qreal scaleX, qreal scaleY, qreal offsetX, qreal offsetY, qreal xDir, qreal yDir, int maxItemsKept);
|
||||
QList<QGraphicsItem *> _items;
|
||||
UPlot * _plot;
|
||||
|
||||
private:
|
||||
void removeItem(UPlotItem * item);
|
||||
|
||||
private:
|
||||
QString _name;
|
||||
QPen _pen;
|
||||
QBrush _brush;
|
||||
qreal _xIncrement;
|
||||
qreal _xStart;
|
||||
bool _visible;
|
||||
bool _valuesShown;
|
||||
QVector<qreal> _minMax; // minX, maxX, minY, maxY
|
||||
QGraphicsRectItem * _rootItem;
|
||||
QColor _itemsColor;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A special UPlotCurve that shows as a line at the specified value, spanning all the UPlot.
|
||||
*/
|
||||
class RTABMAP_GUI_EXPORT UPlotCurveThreshold : public UPlotCurve
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
UPlotCurveThreshold(const QString & name, qreal thesholdValue, Qt::Orientation orientation = Qt::Horizontal, QObject * parent = 0);
|
||||
virtual ~UPlotCurveThreshold();
|
||||
qreal getThreshold() const {return _threshold;}
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Set threshold value.
|
||||
*/
|
||||
void setThreshold(qreal threshold);
|
||||
/**
|
||||
* Set orientation (Qt::Horizontal or Qt::Vertical).
|
||||
*/
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
|
||||
protected:
|
||||
friend class UPlot;
|
||||
virtual void update(qreal scaleX, qreal scaleY, qreal offsetX, qreal offsetY, qreal xDir, qreal yDir, int maxItemsKept);
|
||||
virtual bool isMinMaxValid() const {return false;}
|
||||
|
||||
private:
|
||||
Qt::Orientation _orientation;
|
||||
qreal _threshold;
|
||||
};
|
||||
|
||||
/**
|
||||
* The UPlot axis object.
|
||||
*/
|
||||
class RTABMAP_GUI_EXPORT UPlotAxis : public QWidget
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
UPlotAxis(Qt::Orientation orientation = Qt::Horizontal, qreal min=0, qreal max=1, QWidget * parent = 0);
|
||||
virtual ~UPlotAxis();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Set axis minimum and maximum values, compute the resulting
|
||||
* intervals depending on the size of the axis.
|
||||
*/
|
||||
void setAxis(qreal & min, qreal & max);
|
||||
/**
|
||||
* Size of the border between the first line and the beginning of the widget.
|
||||
*/
|
||||
int border() const {return _border;}
|
||||
/**
|
||||
* Interval step value.
|
||||
*/
|
||||
int step() const {return _step;}
|
||||
/**
|
||||
* Number of intervals.
|
||||
*/
|
||||
int count() const {return _count;}
|
||||
/**
|
||||
* Reverse the axis (for vertical :bottom->up, for horizontal :right->left)
|
||||
*/
|
||||
void setReversed(bool reversed); // Vertical :bottom->up, horizontal :right->left
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent * event);
|
||||
|
||||
private:
|
||||
Qt::Orientation _orientation;
|
||||
qreal _min;
|
||||
qreal _max;
|
||||
int _count;
|
||||
int _step;
|
||||
bool _reversed;
|
||||
int _gradMaxDigits;
|
||||
int _border;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The UPlot legend item. Used internally by UPlot.
|
||||
*/
|
||||
class RTABMAP_GUI_EXPORT UPlotLegendItem : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
UPlotLegendItem(UPlotCurve * curve, QWidget * parent = 0);
|
||||
virtual ~UPlotLegendItem();
|
||||
const UPlotCurve * curve() const {return _curve;}
|
||||
QPixmap createSymbol(const QPen & pen, const QBrush & brush);
|
||||
void showStdDevMeanMax(bool shown);
|
||||
|
||||
Q_SIGNALS:
|
||||
void legendItemRemoved(const UPlotCurve *);
|
||||
void moveUpRequest(UPlotLegendItem *);
|
||||
void moveDownRequest(UPlotLegendItem *);
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateStdDevMeanMax();
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent * event);
|
||||
|
||||
private:
|
||||
UPlotCurve * _curve;
|
||||
QMenu * _menu;
|
||||
QAction * _aChangeText;
|
||||
QAction * _aResetText;
|
||||
QAction * _aChangeColor;
|
||||
QAction * _aCopyToClipboard;
|
||||
QAction * _aShowStdDevMeanMax;
|
||||
QAction * _aRemoveCurve;
|
||||
QAction * _aMoveUp;
|
||||
QAction * _aMoveDown;
|
||||
};
|
||||
|
||||
/**
|
||||
* The UPlot legend. Used internally by UPlot.
|
||||
*/
|
||||
class RTABMAP_GUI_EXPORT UPlotLegend : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
UPlotLegend(QWidget * parent = 0);
|
||||
virtual ~UPlotLegend();
|
||||
|
||||
void setFlat(bool on);
|
||||
bool isFlat() const {return _flat;}
|
||||
void addItem(UPlotCurve * curve);
|
||||
bool remove(const UPlotCurve * curve);
|
||||
QString getAllCurveDataAsText() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void removeLegendItem(const UPlotCurve * curve);
|
||||
void moveUp(UPlotLegendItem * item);
|
||||
void moveDown(UPlotLegendItem * item);
|
||||
|
||||
Q_SIGNALS:
|
||||
void legendItemRemoved(const UPlotCurve * curve);
|
||||
void legendItemToggled(const UPlotCurve * curve, bool toggled);
|
||||
void legendItemMoved(const UPlotCurve * curve, int);
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent * event);
|
||||
|
||||
private Q_SLOTS:
|
||||
void redirectToggled(bool);
|
||||
|
||||
private:
|
||||
bool _flat;
|
||||
QMenu * _menu;
|
||||
QAction * _aUseFlatButtons;
|
||||
QAction * _aCopyAllCurvesToClipboard;
|
||||
QAction * _aShowAllStdDevMeanMax;
|
||||
QLayout * _contentLayout;
|
||||
QScrollArea * _scrollArea;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Orientable QLabel. Inherit QLabel and let you to specify the orientation.
|
||||
*/
|
||||
class RTABMAP_GUI_EXPORT UOrientableLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
UOrientableLabel(const QString & text, Qt::Orientation orientation = Qt::Horizontal, QWidget * parent = 0);
|
||||
virtual ~UOrientableLabel();
|
||||
/**
|
||||
* Get orientation.
|
||||
*/
|
||||
Qt::Orientation orientation() const {return _orientation;}
|
||||
/**
|
||||
* Set orientation (Qt::Vertical or Qt::Horizontal).
|
||||
*/
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
private:
|
||||
Qt::Orientation _orientation;
|
||||
};
|
||||
|
||||
/**
|
||||
* UPlot is a QWidget to create a plot like MATLAB, and
|
||||
* incrementally add new values like a scope using Qt signals/slots.
|
||||
* Many customizations can be done at runtime with the right-click menu.
|
||||
* @image html UPlot.gif
|
||||
* @image html UPlotMenu.png
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* #include "utilite/UPlot.h"
|
||||
* #include <QApplication>
|
||||
*
|
||||
* int main(int argc, char * argv[])
|
||||
* {
|
||||
* QApplication app(argc, argv);
|
||||
* UPlot plot;
|
||||
* UPlotCurve * curve = plot.addCurve("My curve");
|
||||
* qreal y[10] = {0, 1, 2, 3, -3, -2, -1, 0, 1, 2};
|
||||
* curve->addValues(std::vector<qreal>(y, y+10));
|
||||
* plot.showGrid(true);
|
||||
* plot.setGraphicsView(true);
|
||||
* plot.show();
|
||||
* app.exec();
|
||||
* return 0;
|
||||
* }
|
||||
* @endcode
|
||||
* @image html SimplePlot.tiff
|
||||
*
|
||||
*
|
||||
*/
|
||||
class RTABMAP_GUI_EXPORT UPlot : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
UPlot(QWidget * parent = 0);
|
||||
virtual ~UPlot();
|
||||
|
||||
/**
|
||||
* Add a curve. The returned curve doesn't need to be deallocated (UPlot keeps the ownership).
|
||||
*/
|
||||
UPlotCurve * addCurve(const QString & curveName, const QColor & color = QColor());
|
||||
/**
|
||||
* Add a curve. Ownership is transferred to UPlot if ownershipTransferred=true.
|
||||
*/
|
||||
bool addCurve(UPlotCurve * curve, bool ownershipTransferred = true);
|
||||
/**
|
||||
* Get all curve names.
|
||||
*/
|
||||
QStringList curveNames() const;
|
||||
bool contains(const QString & curveName) const;
|
||||
bool isThreshold(const QString & curveName) const;
|
||||
double getThresholdValue(const QString & curveName) const;
|
||||
void removeCurves();
|
||||
QString getAllCurveDataAsText() const;
|
||||
/**
|
||||
* Add a threshold to the plot.
|
||||
*/
|
||||
UPlotCurveThreshold * addThreshold(const QString & name, qreal 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 trackMouse(bool tracking);
|
||||
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(qreal x1, qreal x2);
|
||||
void setFixedYAxis(qreal y1, qreal 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);
|
||||
void setBackgroundColor(const QColor & color);
|
||||
QRectF sceneRect() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
*
|
||||
* Remove a curve. If UPlot is the parent of the curve, the curve is deleted.
|
||||
*/
|
||||
void removeCurve(const UPlotCurve * curve);
|
||||
void showCurve(const UPlotCurve * curve, bool shown);
|
||||
void updateAxis(); //reset axis and recompute it with all curves minMax
|
||||
/**
|
||||
*
|
||||
* Clear all curves' data.
|
||||
*/
|
||||
void clearData();
|
||||
|
||||
void frameData(bool xAxis = true, bool yAxis = false);
|
||||
|
||||
private Q_SLOTS:
|
||||
void captureScreen();
|
||||
void updateAxis(const UPlotCurve * curve);
|
||||
void moveCurve(const UPlotCurve *, int index);
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent * event);
|
||||
virtual void paintEvent(QPaintEvent * event);
|
||||
virtual void resizeEvent(QResizeEvent * event);
|
||||
virtual void mousePressEvent(QMouseEvent * event);
|
||||
virtual void mouseMoveEvent(QMouseEvent * event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent * event);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent * event);
|
||||
|
||||
private:
|
||||
friend class UPlotCurve;
|
||||
void addItem(QGraphicsItem * item);
|
||||
|
||||
private:
|
||||
void replot(QPainter * painter);
|
||||
bool updateAxis(qreal x, qreal y);
|
||||
bool updateAxis(qreal x1, qreal x2, qreal y1, qreal y2);
|
||||
void setupUi();
|
||||
void createActions();
|
||||
void createMenus();
|
||||
void selectScreenCaptureFormat();
|
||||
bool mousePosToValue(const QPoint & pos, qreal & x, qreal & y);
|
||||
|
||||
private:
|
||||
UPlotLegend * _legend;
|
||||
QGraphicsView * _view;
|
||||
QGraphicsItem * _sceneRoot;
|
||||
QWidget * _graphicsViewHolder;
|
||||
qreal _axisMaximums[4]; // {x1->x2, y1->y2}
|
||||
bool _axisMaximumsSet[4]; // {x1->x2, y1->y2}
|
||||
bool _fixedAxis[2];
|
||||
UPlotAxis * _verticalAxis;
|
||||
UPlotAxis * _horizontalAxis;
|
||||
int _penStyleCount;
|
||||
int _maxVisibleItems;
|
||||
QList<QGraphicsLineItem *> hGridLines;
|
||||
QList<QGraphicsLineItem *> vGridLines;
|
||||
QList<UPlotCurve*> _curves;
|
||||
QLabel * _title;
|
||||
QLabel * _xLabel;
|
||||
UOrientableLabel * _yLabel;
|
||||
QLabel * _refreshRate;
|
||||
QString _workingDirectory;
|
||||
QElapsedTimer _refreshIntervalTime;
|
||||
int _lowestRefreshRate;
|
||||
QElapsedTimer _refreshStartTime;
|
||||
QString _autoScreenCaptureFormat;
|
||||
QPoint _mousePressedPos;
|
||||
QPoint _mouseCurrentPos;
|
||||
QColor _bgColor;
|
||||
|
||||
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 * _aChangeBackgroundColor;
|
||||
QAction * _aYLabelVertical;
|
||||
QAction * _aShowRefreshRate;
|
||||
QAction * _aMouseTracking;
|
||||
QAction * _aSaveFigure;
|
||||
QAction * _aAutoScreenCapture;
|
||||
QAction * _aClearData;
|
||||
QAction * _aGraphicsView;
|
||||
};
|
||||
|
||||
#endif /* UPLOT_H_ */
|
||||
Reference in New Issue
Block a user