added CalibrationDialog class and Calibration tool app

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1587 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-07-22 22:22:59 +00:00
parent 3328a7c9a0
commit c1497d9e92
5 changed files with 757 additions and 3 deletions

View File

@@ -0,0 +1,67 @@
/*
* CalibrationDialog.h
*
* Created on: 2014-07-22
* Author: Mathieu
*/
#ifndef CALIBRATIONDIALOG_H_
#define CALIBRATIONDIALOG_H_
#include "rtabmap/gui/RtabmapGuiExp.h" // DLL export/import defines
#include <QtGui/QDialog>
#include <opencv2/opencv.hpp>
#include <rtabmap/utilite/UEventsHandler.h>
class Ui_calibrationDialog;
namespace rtabmap {
class RTABMAPGUI_EXP CalibrationDialog : public QDialog, public UEventsHandler
{
Q_OBJECT;
public:
CalibrationDialog(QWidget * parent = 0);
virtual ~CalibrationDialog();
private slots:
void processImage(const cv::Mat & image);
void restart();
void calibrate();
void exit();
protected:
virtual void closeEvent(QCloseEvent* event);
virtual void handleEvent(UEvent * event);
private:
float getArea(const std::vector<cv::Point2f> & corners, const cv::Size & boardSize);
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
cv::Size boardSize_; // innner squares
float squareSize_; // m
std::vector<std::vector<cv::Point2f> > imagePoints_;
std::vector<std::vector<float> > imageParams_;
cv::Size imageSize_;
bool calibrated_;
cv::Mat cameraMatrix_;
cv::Mat distCoeffs_;
Ui_calibrationDialog * ui_;
};
} /* namespace rtabmap */
#endif /* CALIBRATIONDIALOG_H_ */