various bug fixes around free trigger mode, display strings and image pipe robustness

This commit is contained in:
uvos 2021-06-18 16:52:39 +02:00
parent 86ec50575b
commit d5af9adec9
12 changed files with 85 additions and 25 deletions

View file

@ -4,6 +4,7 @@
#include <QDebug>
#include <QMessageBox>
#include <QFileDialog>
#include <opencv2/imgproc.hpp>
#include "configurecameradialog.h"
@ -44,6 +45,7 @@ EditProfileDialog::EditProfileDialog(Cameras* cameras, const Profile profile, QW
}
ui->calLed->setLit(profile_.calcurve.data);
ui->ledLightmap->setLit(profile_.lightmap.data);
connect(ui->doubleSpinBoxBrightness, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double in){profile_.lighting.brightness = in/100.0;});
connect(ui->doubleSpinBoxExposure, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double in){profile_.exposureTime = in; invalidateCameras();});
@ -53,9 +55,11 @@ EditProfileDialog::EditProfileDialog(Cameras* cameras, const Profile profile, QW
connect(ui->checkBoxCh3, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
connect(ui->checkBoxCh4, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
connect(ui->pushButton, &QPushButton::clicked, this, &EditProfileDialog::configureCamera);
connect(ui->checkBoxNodistort, &QCheckBox::stateChanged, [this](int state){profile_.nodistort = state == Qt::Checked ?: false; setConfigured();});
connect(ui->checkBoxNodistort, &QCheckBox::stateChanged, [this](int state){profile_.nodistort = state == Qt::Checked; setConfigured();});
connect(ui->pushButtonCalLoad, &QPushButton::clicked, this, &EditProfileDialog::loadCalcurve);
connect(ui->pushButtonLightmapLoad, &QPushButton::clicked, this, &EditProfileDialog::loadCalcurve);
connect(ui->pushButtonLightmapLoad, &QPushButton::clicked, this, &EditProfileDialog::loadLightmap);
connect(ui->pushButtonCalClear, &QPushButton::clicked, [this](){profile_.calcurve.release(); ui->calLed->setLit(profile_.calcurve.data);});
connect(ui->pushButtonLightmapClear, &QPushButton::clicked, [this](){profile_.lightmap.release(); ui->ledLightmap->setLit(profile_.lightmap.data);});
ui->listView->setCameras(cameras_->getCameras());
ui->listView->setSelectionMode(QAbstractItemView::SingleSelection);
setConfigured();
@ -66,20 +70,22 @@ void EditProfileDialog::loadLightmap()
QString fileName = QFileDialog::getOpenFileName(this, "Open Lightmap", "./", "*.mat");
if(!fileName.isEmpty())
{
profile_.calcurve.release();
profile_.lightmap.release();
cv::FileStorage matf(fileName.toStdString(), cv::FileStorage::READ);
matf["image"]>>profile_.lightmap;
if(matf.isOpened() && (!profile_.calcurve.data || profile_.calcurve.type() != CV_32FC1))
matf.release();
if(matf.isOpened() && (!profile_.lightmap.data || profile_.lightmap.type() != CV_32FC1))
{
profile_.lightmap.release();
QMessageBox::warning(this, "Invalid file", "File selected dose not contain a valid lightmap");
}
else if(!profile_.calcurve.data)
else if(!profile_.lightmap.data)
{
QMessageBox::warning(this, "Can no open", "Can not open file selected");
}
matf.release();
profile_.lightmap = cv::mean(profile_.lightmap)/profile_.lightmap;
cv::GaussianBlur(profile_.lightmap, profile_.lightmap, cv::Size(51,51), 8);
ui->ledLightmap->setLit(profile_.lightmap.data);
}
}