fix various bugs

add commandline parser for various options
allow cameras to be operated in serial fashion
allow disabeling of quirks
allow changing of Photonfocus quirk timeings
This commit is contained in:
2021-07-08 11:24:19 +02:00
parent 3a77df6dd5
commit b9b4b0fc2a
10 changed files with 134 additions and 36 deletions

View File

@ -9,11 +9,12 @@
#include <opencv2/imgproc.hpp>
#include <QDebug>
ConfigureCameraDialog::ConfigureCameraDialog(const CameraSetup& setup, std::shared_ptr<Camera> camera, double exposureTime, QWidget *parent):
ConfigureCameraDialog::ConfigureCameraDialog(const CameraSetup& setup, std::shared_ptr<Camera> camera, double exposureTime, bool nodistort, QWidget *parent):
QDialog(parent),
setup_(setup),
camera_(camera),
profileExposure_(exposureTime),
nodistort_(nodistort),
ui(new Ui::ConfigureCameraDialog)
{
ui->setupUi(this);
@ -21,6 +22,14 @@ ConfigureCameraDialog::ConfigureCameraDialog(const CameraSetup& setup, std::shar
ui->doubleSpinBox->setValue(profileExposure_);
setExposure(profileExposure_);
if(nodistort)
{
ui->ledRemap->setHidden(true);
ui->label_2->setHidden(true);
ui->pushButtonRemapClear->setHidden(true);
ui->pushButtonRemapCreate->setHidden(true);
}
switch(setup.bayerMode)
{
case cam::Camera::BAYER_BLUE:
@ -215,5 +224,5 @@ bool ConfigureCameraDialog::checkConfig()
ui->ledDark->setLit(darkMapOK);
ui->ledRemap->setLit(remapMapOk);
return remapMapOk;
return remapMapOk || nodistort_;
}

View File

@ -23,6 +23,7 @@ class ConfigureCameraDialog : public QDialog
int mode_ = MODE_IDLE;
cv::Mat fgImage;
double profileExposure_;
bool nodistort_;
private:
bool checkConfig();
@ -40,7 +41,7 @@ public slots:
void accept() override;
public:
explicit ConfigureCameraDialog(const CameraSetup& setup, const std::shared_ptr<Camera> camera, double exposureTime = 1.0/60, QWidget *parent = nullptr);
explicit ConfigureCameraDialog(const CameraSetup& setup, const std::shared_ptr<Camera> camera, double exposureTime = 1.0/60, bool nodistort = false, QWidget *parent = nullptr);
~ConfigureCameraDialog();
CameraSetup getCameraSetup(){return setup_;}

View File

@ -48,7 +48,7 @@ EditProfileDialog::EditProfileDialog(Cameras* cameras, const Profile profile, QW
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();});
connect(ui->doubleSpinBoxExposure, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double in){profile_.exposureTime = in;});
connect(ui->lineEditName, &QLineEdit::textChanged, [this](QString in){profile_.setName(in);});
connect(ui->checkBoxCh1, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
connect(ui->checkBoxCh2, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
@ -168,7 +168,7 @@ void EditProfileDialog::configureCamera()
std::shared_ptr<Camera> camera = cameras_->getCamera(profile_.cameras[i].id);
if(camera)
{
ConfigureCameraDialog diag(profile_.cameras[i], camera, profile_.exposureTime, this);
ConfigureCameraDialog diag(profile_.cameras[i], camera, profile_.exposureTime, profile_.nodistort, this);
diag.show();
int ret = diag.exec();
if(ret == QDialog::Accepted)
@ -182,8 +182,10 @@ void EditProfileDialog::configureCamera()
void EditProfileDialog::accept()
{
if(!setConfigured() || profile_.getName() == "Unamed")
if(!setConfigured())
QMessageBox::information(this, "Unfinished", "Can not accept with unconfigured cameras");
else if(profile_.getName().isEmpty() || profile_.getName() == "Unamed")
QMessageBox::information(this, "Unfinished", "A profile name is required");
else
QDialog::accept();
}

View File

@ -26,7 +26,10 @@
<item>
<widget class="QLineEdit" name="lineEditName">
<property name="text">
<string>Unamed</string>
<string notr="true"/>
</property>
<property name="placeholderText">
<string notr="true">Unamed</string>
</property>
</widget>
</item>

View File

@ -151,6 +151,7 @@ QString MainWindow::getProfileName()
void MainWindow::refreshProfiles()
{
QString tmp = ui->comboBox->currentText();
ui->comboBox->clear();
QList<QString> profiles = Profile::avaiableProfiles();
for(const QString& string : profiles)