Calibration: added max scale parameter

This commit is contained in:
matlabbe
2016-04-25 17:02:25 -04:00
parent 8e1fc0df56
commit f408ef8922
3 changed files with 36 additions and 1 deletions

View File

@@ -80,6 +80,7 @@ CalibrationDialog::CalibrationDialog(bool stereo, const QString & savingDirector
connect(ui_->spinBox_boardWidth, SIGNAL(valueChanged(int)), this, SLOT(setBoardWidth(int)));
connect(ui_->spinBox_boardHeight, SIGNAL(valueChanged(int)), this, SLOT(setBoardHeight(int)));
connect(ui_->doubleSpinBox_squareSize, SIGNAL(valueChanged(double)), this, SLOT(setSquareSize(double)));
connect(ui_->spinBox_maxScale, SIGNAL(valueChanged(int)), this, SLOT(setMaxScale(int)));
connect(ui_->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
@@ -112,6 +113,7 @@ void CalibrationDialog::saveSettings(QSettings & settings, const QString & group
settings.setValue("board_width", ui_->spinBox_boardWidth->value());
settings.setValue("board_height", ui_->spinBox_boardHeight->value());
settings.setValue("board_square_size", ui_->doubleSpinBox_squareSize->value());
settings.setValue("max_scale", ui_->spinBox_maxScale->value());
settings.setValue("geometry", this->saveGeometry());
if(!group.isEmpty())
{
@@ -128,6 +130,7 @@ void CalibrationDialog::loadSettings(QSettings & settings, const QString & group
this->setBoardWidth(settings.value("board_width", ui_->spinBox_boardWidth->value()).toInt());
this->setBoardHeight(settings.value("board_height", ui_->spinBox_boardHeight->value()).toInt());
this->setSquareSize(settings.value("board_square_size", ui_->doubleSpinBox_squareSize->value()).toDouble());
this->setMaxScale(settings.value("max_scale", ui_->spinBox_maxScale->value()).toDouble());
QByteArray bytes = settings.value("geometry", QByteArray()).toByteArray();
if(!bytes.isEmpty())
{
@@ -205,6 +208,14 @@ void CalibrationDialog::setSquareSize(double size)
}
}
void CalibrationDialog::setMaxScale(int scale)
{
if(scale != ui_->spinBox_maxScale->value())
{
ui_->spinBox_maxScale->setValue(scale);
}
}
void CalibrationDialog::closeEvent(QCloseEvent* event)
{
if(!savedCalibration_ && models_[0].isValidForRectification() &&
@@ -360,7 +371,7 @@ void CalibrationDialog::processImages(const cv::Mat & imageLeft, const cv::Mat &
if(!viewGray.empty())
{
int maxScale = viewGray.cols < 640?2:1;
int maxScale = ui_->spinBox_maxScale->value();
for( int scale = 1; scale <= maxScale; scale++ )
{
cv::Mat timg;

View File

@@ -232,6 +232,29 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="spinBox_maxScale">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>3</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_22">
<property name="toolTip">
<string>Number of inner squares on the board</string>
</property>
<property name="text">
<string>Max scale</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>