GUI: Added new Freenect2 and StereoDC1394 source options.

This commit is contained in:
Mathieu Labbe
2015-04-06 00:28:04 -04:00
parent fee32c4e25
commit 04b35b2adf
22 changed files with 765 additions and 758 deletions

View File

@@ -31,6 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/gui/RtabmapGuiExp.h" // DLL export/import defines
#include <QDialog>
#include <QSettings>
#include <opencv2/opencv.hpp>
#include <rtabmap/core/CameraModel.h>
@@ -46,16 +47,18 @@ class RTABMAPGUI_EXP CalibrationDialog : public QDialog, public UEventsHandler
Q_OBJECT;
public:
CalibrationDialog(bool stereo = false, QWidget * parent = 0);
CalibrationDialog(bool stereo = false, const QString & savingDirectory = ".", QWidget * parent = 0);
virtual ~CalibrationDialog();
bool isCalibrated() const {return calibrated_;}
const cv::Mat & cameraMatrix() const {return model_.K();} // Matrix K
const cv::Mat & distCoeffs() const {return model_.D();} // Matrix D
float fx() const {return model_.fx();} // K(0)
float fy() const {return model_.fy();} // K(4)
float cx() const {return model_.cx();} // K(2)
float cy() const {return model_.cy();} // K(5)
const rtabmap::CameraModel & getCameraModel() const {return model_;}
const rtabmap::StereoCameraModel & getStereoCameraModel() const {return stereoModel_;}
void saveSettings(QSettings & settings, const QString & group = "") const;
void loadSettings(QSettings & settings, const QString & group = "");
void setStereoMode(bool stereo);
void setSavingDirectory(const QString & savingDirectory) {savingDirectory_ = savingDirectory;}
public slots:
void setBoardWidth(int width);
@@ -66,7 +69,7 @@ private slots:
void processImages(const cv::Mat & imageLeft, const cv::Mat & imageRight, const QString & cameraName);
void restart();
void calibrate();
void save();
bool save();
protected:
virtual void closeEvent(QCloseEvent* event);
@@ -85,13 +88,13 @@ private:
private:
// parameters
cv::Size boardSize_; // innner squares
float squareSize_; // m
bool stereo_;
QString savingDirectory_;
QString cameraName_;
bool calibrated_;
bool processingData_;
bool savedCalibration_;
std::vector<std::vector<std::vector<cv::Point2f> > > imagePoints_;
std::vector<std::vector<std::vector<float> > > imageParams_;

View File

@@ -0,0 +1,61 @@
/*
Copyright (c) 2010-2014, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Universite de Sherbrooke nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
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 CAMERAVIEWER_H_
#define CAMERAVIEWER_H_
#include "rtabmap/gui/RtabmapGuiExp.h" // DLL export/import defines
#include <rtabmap/utilite/UEventsHandler.h>
#include <QWidget>
#include <rtabmap/core/SensorData.h>
namespace rtabmap {
class ImageView;
class CloudViewer;
class RTABMAPGUI_EXP CameraViewer : public QWidget, public UEventsHandler
{
Q_OBJECT
public:
CameraViewer(QWidget * parent = 0);
virtual ~CameraViewer();
public slots:
void showImage(const rtabmap::SensorData & data);
protected:
void handleEvent(UEvent * event);
private:
ImageView* imageView_;
CloudViewer* cloudView_;
bool processingImages_;
};
} /* namespace rtabmap */
#endif /* CAMERAVIEWER_H_ */

View File

@@ -148,6 +148,8 @@ private slots:
void selectOpenniCv();
void selectOpenniCvAsus();
void selectOpenni2();
void selectFreenect2();
void selectStereoDC1394();
void dumpTheMemory();
void dumpThePrediction();
void downloadAllClouds();

View File

@@ -61,6 +61,8 @@ class OdometryThread;
class CameraThread;
class Signature;
class LoopClosureViewer;
class CameraRGBD;
class CalibrationDialog;
class RTABMAPGUI_EXP PreferencesDialog : public QDialog
{
@@ -87,7 +89,9 @@ public:
kSrcFreenect,
kSrcOpenNI_CV,
kSrcOpenNI_CV_ASUS,
kSrcOpenNI2
kSrcOpenNI2,
kSrcFreenect2,
kSrcStereoDC1394
};
public:
@@ -159,7 +163,7 @@ public:
bool isSourceMirroring() const;
bool isSourceImageUsed() const;
bool isSourceDatabaseUsed() const;
bool isSourceOpenniUsed() const;
bool isSourceRGBDUsed() const;
PreferencesDialog::Src getSourceImageType() const;
QString getSourceImageTypeStr() const;
int getSourceWidth() const;
@@ -182,10 +186,7 @@ public:
bool getSourceOpenni2Mirroring() const; //Openni group
QString getSourceOpenniDevice() const; //Openni group
Transform getSourceOpenniLocalTransform() const; //Openni group
float getSourceOpenniFx() const; // Openni group
float getSourceOpenniFy() const; // Openni group
float getSourceOpenniCx() const; // Openni group
float getSourceOpenniCy() const; // Openni group
CameraRGBD * createCameraRGBD() const; // return camera should be deleted if not null
int getIgnoredDCComponents() const;
@@ -200,6 +201,7 @@ public:
double getLoopThr() const;
double getVpThr() const;
int getOdomStrategy() const;
QString getCameraInfoDir() const; // "workinfDir/camera_info"
//
void setMonitoringState(bool monitoringState) {_monitoringState = monitoringState;}
@@ -216,6 +218,7 @@ public slots:
void selectSourceImage(Src src = kSrcUndef);
void selectSourceDatabase(bool user = false);
void selectSourceRGBD(Src src = kSrcUndef);
void calibrate();
private slots:
void closeDialog ( QAbstractButton * button );
@@ -246,8 +249,6 @@ private slots:
void testOdometry();
void cleanRGBDCameraTest();
void testRGBDCamera();
void calibrate();
void resetCalibration();
protected:
virtual void showEvent ( QShowEvent * event );
@@ -302,6 +303,9 @@ private:
CameraThread * _cameraThread;
OdometryThread * _odomThread;
//calibration
CalibrationDialog * _calibrationDialog;
QVector<QCheckBox*> _3dRenderingShowClouds;
QVector<QDoubleSpinBox*> _3dRenderingVoxelSize;
QVector<QSpinBox*> _3dRenderingDecimation;