Homography: added maxIterations and configences parameters (OpenCV3). Updated doubleSpinBox decimals/singleStep.
This commit is contained in:
@@ -1251,11 +1251,21 @@ protected:
|
||||
}
|
||||
|
||||
UDEBUG("Find homography... begin");
|
||||
#if CV_MAJOR_VERSION < 3
|
||||
h_ = findHomography(mpts_1,
|
||||
mpts_2,
|
||||
Settings::getHomographyMethod(),
|
||||
Settings::getHomography_ransacReprojThr(),
|
||||
outlierMask_);
|
||||
#else
|
||||
h_ = findHomography(mpts_1,
|
||||
mpts_2,
|
||||
Settings::getHomographyMethod(),
|
||||
Settings::getHomography_ransacReprojThr(),
|
||||
outlierMask_,
|
||||
Settings::getHomography_maxIterations(),
|
||||
Settings::getHomography_confidence());
|
||||
#endif
|
||||
UDEBUG("Find homography... end");
|
||||
|
||||
UASSERT(outlierMask_.size() == 0 || outlierMask_.size() == mpts_1.size());
|
||||
|
||||
@@ -272,6 +272,8 @@ MainWindow::MainWindow(FindObject * findObject, Camera * camera, QWidget * paren
|
||||
//Setup drag and drop images
|
||||
connect(ui_->imageDrop_objects, SIGNAL(imagesReceived(const QStringList &)), this, SLOT(addObjectsFromFiles(const QStringList &)));
|
||||
connect(ui_->imageDrop_scene, SIGNAL(imagesReceived(const QStringList &)), this, SLOT(loadSceneFromFile(const QStringList &)));
|
||||
|
||||
ui_->imageView_source->setFocus();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -316,6 +318,22 @@ void MainWindow::closeEvent(QCloseEvent * event)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//catch ctrl-s to save settings
|
||||
if(event->key() == Qt::Key_Space)
|
||||
{
|
||||
if(ui_->actionStart_camera->isEnabled())
|
||||
{
|
||||
startProcessing();
|
||||
}
|
||||
else if(ui_->actionPause_camera->isEnabled())
|
||||
{
|
||||
pauseProcessing();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setupTCPServer()
|
||||
{
|
||||
if(tcpServer_)
|
||||
|
||||
@@ -420,14 +420,47 @@ void ParametersToolBox::addParameter(QVBoxLayout * layout,
|
||||
const double & value)
|
||||
{
|
||||
QDoubleSpinBox * widget = new QDoubleSpinBox(this);
|
||||
int decimals = 0;
|
||||
int decimalValue = 0;
|
||||
|
||||
QString str = QString::number(Settings::getDefaultParameters().value(key).toDouble());
|
||||
str.remove( QRegExp("0+$") );
|
||||
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
str.replace(',', '.');
|
||||
QStringList items = str.split('.');
|
||||
if(items.size() == 2)
|
||||
{
|
||||
decimals = items.back().length();
|
||||
decimalValue = items.back().toInt();
|
||||
}
|
||||
}
|
||||
|
||||
double def = Settings::getDefaultParameters().value(key).toDouble();
|
||||
if(def<0.01)
|
||||
if(def<0.001 || (decimals >= 4 && decimalValue>0))
|
||||
{
|
||||
widget->setDecimals(5);
|
||||
widget->setSingleStep(0.0001);
|
||||
}
|
||||
else if(def<0.01 || (decimals >= 3 && decimalValue>0))
|
||||
{
|
||||
widget->setDecimals(4);
|
||||
widget->setSingleStep(0.001);
|
||||
}
|
||||
else if(def<0.1)
|
||||
else if(def<0.1 || (decimals >= 2 && decimalValue>0))
|
||||
{
|
||||
widget->setDecimals(3);
|
||||
widget->setSingleStep(0.01);
|
||||
}
|
||||
else if(def<1.0 || (decimals >= 1 && decimalValue>0))
|
||||
{
|
||||
widget->setDecimals(2);
|
||||
widget->setSingleStep(0.1);
|
||||
}
|
||||
else
|
||||
{
|
||||
widget->setDecimals(1);
|
||||
}
|
||||
|
||||
if(def>0.0)
|
||||
|
||||
Reference in New Issue
Block a user