various bug fixes around free trigger mode, display strings and image pipe robustness
This commit is contained in:
@ -35,6 +35,8 @@ ConfigureCameraDialog::ConfigureCameraDialog(const CameraSetup& setup, std::shar
|
||||
connect(ui->pushButtonDarkImageCreate, &QPushButton::clicked, this, &ConfigureCameraDialog::captureDark);
|
||||
connect(ui->pushButtonCapture, &QPushButton::clicked, this, &ConfigureCameraDialog::takeImage);
|
||||
connect(camera_.get(), &Camera::newImage, this, &ConfigureCameraDialog::gotImage);
|
||||
connect(ui->pushButtonBgShow, &QPushButton::clicked, [this](){if(setup_.bgmask.data) ui->widget_4->setImage(Camera::Image(setup_.bgmask, 0));});
|
||||
connect(ui->pushButtonDarkImageShow, &QPushButton::clicked, [this](){if(setup_.darkmap.data) ui->widget_4->setImage(Camera::Image(setup_.darkmap, 0));});
|
||||
|
||||
checkConfig();
|
||||
}
|
||||
@ -157,6 +159,8 @@ bool ConfigureCameraDialog::checkConfig()
|
||||
ui->pushButtonBgClear->setEnabled(bgOk);
|
||||
ui->pushButtonDarkImageClear->setEnabled(darkMapOK);
|
||||
ui->pushButtonRemapClear->setEnabled(remapMapOk);
|
||||
ui->pushButtonDarkImageShow->setEnabled(darkMapOK);
|
||||
ui->pushButtonBgShow->setEnabled(bgOk);
|
||||
|
||||
ui->ledBg->setLit(bgOk);
|
||||
ui->ledDark->setLit(darkMapOK);
|
||||
|
@ -97,6 +97,9 @@
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pushButtonDarkImageShow">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
@ -120,6 +123,9 @@
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pushButtonBgShow">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
|
@ -65,7 +65,12 @@ void CvImageViewer::setImage(Camera::Image img)
|
||||
}
|
||||
else if(image_.type() == CV_32FC1 || image_.type() == CV_64FC1)
|
||||
{
|
||||
img.mat.convertTo(image_, CV_8UC1, 255, 0);
|
||||
double min, max;
|
||||
cv::minMaxIdx(img.mat, &min, &max);
|
||||
double a = 255.0/(max - min);
|
||||
double b = 0-(min*a);
|
||||
qDebug()<<min<<max<<a<<b;
|
||||
img.mat.convertTo(image_, CV_8UC1, a, b);
|
||||
qimage_ = QImage(image_.data, image_.cols, image_.rows, image_.step, QImage::Format_Grayscale8);
|
||||
}
|
||||
else
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -201,6 +201,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Lightmap:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Led" name="calLed" native="true">
|
||||
<property name="sizePolicy">
|
||||
@ -230,10 +237,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButtonLightmapLoad">
|
||||
<property name="text">
|
||||
<string>Lightmap:</string>
|
||||
<string>Load</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -253,10 +260,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButtonLightmapLoad">
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pushButtonCalClear">
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pushButtonLightmapClear">
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -63,7 +63,7 @@ void MainWindow::openImage()
|
||||
if(matf.isOpened() && (!image.data || image.type() != CV_32FC1))
|
||||
{
|
||||
image.release();
|
||||
QMessageBox::warning(this, "Invalid file", "File selected dose not contain a valid lightmap");
|
||||
QMessageBox::warning(this, "Invalid file", "File selected dose not contain a valid image");
|
||||
}
|
||||
else if(!image.data)
|
||||
{
|
||||
|
Reference in New Issue
Block a user