add kfactor support
This commit is contained in:
@ -99,7 +99,12 @@ cv::Mat ImagePipeline::process(const Profile profile, std::vector<Camera::Image>
|
|||||||
RemapedImage remaped = applyRemap(image.mat, camera.remapMap);
|
RemapedImage remaped = applyRemap(image.mat, camera.remapMap);
|
||||||
qDebug()<<"Camera"<<camera.id<<"image remaped to"<<remaped.image.data<<remaped.image.rows<<remaped.image.cols
|
qDebug()<<"Camera"<<camera.id<<"image remaped to"<<remaped.image.data<<remaped.image.rows<<remaped.image.cols
|
||||||
<<"at"<<remaped.origin.x<<'x'<<remaped.origin.y;
|
<<"at"<<remaped.origin.x<<'x'<<remaped.origin.y;
|
||||||
remapedImages.push_back(applyRemap(image.mat, camera.remapMap));
|
RemapedImage remapedImage = applyRemap(image.mat, camera.remapMap);
|
||||||
|
if(profile.kFactor != 0 && remapedImage.image.type() == CV_8UC1)
|
||||||
|
applyKfactor(remapedImage.image, remapedImage.angleX, profile.kFactor);
|
||||||
|
else if(profile.kFactor != 0)
|
||||||
|
qWarning()<<"Can not apply k factor due to image format";
|
||||||
|
remapedImages.push_back(remapedImage);
|
||||||
matched = true;
|
matched = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -118,7 +123,8 @@ cv::Mat ImagePipeline::process(const Profile profile, std::vector<Camera::Image>
|
|||||||
|
|
||||||
if(remapedImages.size() > 0)
|
if(remapedImages.size() > 0)
|
||||||
{
|
{
|
||||||
std::sort(remapedImages.begin(), remapedImages.end(), [](const RemapedImage& imgA, const RemapedImage& imgB) -> bool {return imgA.origin.x < imgB.origin.x;});
|
std::sort(remapedImages.begin(), remapedImages.end(),
|
||||||
|
[](const RemapedImage& imgA, const RemapedImage& imgB) -> bool {return imgA.origin.x < imgB.origin.x;});
|
||||||
cv::Mat output;
|
cv::Mat output;
|
||||||
if(simpleStichingAlg)
|
if(simpleStichingAlg)
|
||||||
output = simpleStich(remapedImages);
|
output = simpleStich(remapedImages);
|
||||||
|
@ -66,6 +66,7 @@ void Profile::store(QSettings& settings) const
|
|||||||
settings.setValue(GROUP + QString("/exposureTime"), exposureTime);
|
settings.setValue(GROUP + QString("/exposureTime"), exposureTime);
|
||||||
settings.setValue(GROUP + QString("/name"), name_);
|
settings.setValue(GROUP + QString("/name"), name_);
|
||||||
settings.setValue(GROUP + QString("/nodistort"), nodistort);
|
settings.setValue(GROUP + QString("/nodistort"), nodistort);
|
||||||
|
settings.setValue(GROUP + QString("/kfact"), kFactor);
|
||||||
|
|
||||||
if(lightmap.data)
|
if(lightmap.data)
|
||||||
cv::imwrite((profileLocation() + QString::number(id) + ".lightmap.png").toStdString(), lightmap);
|
cv::imwrite((profileLocation() + QString::number(id) + ".lightmap.png").toStdString(), lightmap);
|
||||||
@ -97,6 +98,8 @@ void Profile::load(QSettings &settings)
|
|||||||
name_ = settings.value(GROUP + QString("/name"), "NULL").toString();
|
name_ = settings.value(GROUP + QString("/name"), "NULL").toString();
|
||||||
nodistort = settings.value(GROUP + QString("/nodistort"), "NULL").toBool();
|
nodistort = settings.value(GROUP + QString("/nodistort"), "NULL").toBool();
|
||||||
|
|
||||||
|
kFactor = settings.value(GROUP + QString("/kfact"), 0).toDouble();
|
||||||
|
|
||||||
lightmap = cv::imread((profileLocation() + QString::number(id) + ".lightmap.png").toStdString());
|
lightmap = cv::imread((profileLocation() + QString::number(id) + ".lightmap.png").toStdString());
|
||||||
|
|
||||||
int size = settings.beginReadArray(GROUP + QString("/cameras"));
|
int size = settings.beginReadArray(GROUP + QString("/cameras"));
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
cv::Mat calcurve;
|
cv::Mat calcurve;
|
||||||
std::vector<CameraSetup> cameras;
|
std::vector<CameraSetup> cameras;
|
||||||
bool nodistort = false;
|
bool nodistort = false;
|
||||||
|
float kFactor = 0;
|
||||||
|
|
||||||
Profile(const QString& name = "");
|
Profile(const QString& name = "");
|
||||||
void store(QSettings& settings) const;
|
void store(QSettings& settings) const;
|
||||||
|
@ -50,6 +50,7 @@ EditProfileDialog::EditProfileDialog(Cameras* cameras, const Profile profile, QW
|
|||||||
|
|
||||||
connect(ui->doubleSpinBoxBrightness, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double in){profile_.lighting.brightness = in/100.0;});
|
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;});
|
connect(ui->doubleSpinBoxExposure, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double in){profile_.exposureTime = in;});
|
||||||
|
connect(ui->doubleSpinBox_kFactor, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double in){profile_.kFactor = in;});
|
||||||
connect(ui->lineEditName, &QLineEdit::textChanged, [this](QString in){profile_.setName(in);});
|
connect(ui->lineEditName, &QLineEdit::textChanged, [this](QString in){profile_.setName(in);});
|
||||||
connect(ui->checkBoxCh1, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
|
connect(ui->checkBoxCh1, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
|
||||||
connect(ui->checkBoxCh2, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
|
connect(ui->checkBoxCh2, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
|
||||||
|
@ -192,25 +192,35 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>k factor:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBox_kFactor">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-100.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>100.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>Calibration curve:</string>
|
|
||||||
</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">
|
<item row="0" column="1">
|
||||||
<widget class="Led" name="calLed" native="true">
|
<widget class="Led" name="calLed" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -227,6 +237,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QPushButton" name="pushButtonLightmapLoad">
|
||||||
|
<property name="text">
|
||||||
|
<string>Load</string>
|
||||||
|
</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="2">
|
<item row="0" column="2">
|
||||||
<widget class="QPushButton" name="pushButtonCalLoad">
|
<widget class="QPushButton" name="pushButtonCalLoad">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -240,10 +264,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="0" column="3">
|
||||||
<widget class="QPushButton" name="pushButtonLightmapLoad">
|
<widget class="QPushButton" name="pushButtonCalClear">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load</string>
|
<string>Clear</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Calibration curve:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -263,13 +294,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QPushButton" name="pushButtonCalClear">
|
|
||||||
<property name="text">
|
|
||||||
<string>Clear</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
<item row="1" column="3">
|
||||||
<widget class="QPushButton" name="pushButtonLightmapClear">
|
<widget class="QPushButton" name="pushButtonLightmapClear">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
Reference in New Issue
Block a user