add kfactor support
This commit is contained in:
		
							parent
							
								
									7350c6ce96
								
							
						
					
					
						commit
						1b6c3672b6
					
				
					 5 changed files with 61 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -99,7 +99,12 @@ cv::Mat ImagePipeline::process(const Profile profile, std::vector<Camera::Image>
 | 
			
		|||
						RemapedImage remaped = applyRemap(image.mat, camera.remapMap);
 | 
			
		||||
						qDebug()<<"Camera"<<camera.id<<"image remaped to"<<remaped.image.data<<remaped.image.rows<<remaped.image.cols
 | 
			
		||||
								<<"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;
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +123,8 @@ cv::Mat ImagePipeline::process(const Profile profile, std::vector<Camera::Image>
 | 
			
		|||
 | 
			
		||||
	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;
 | 
			
		||||
		if(simpleStichingAlg)
 | 
			
		||||
			output = simpleStich(remapedImages);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,6 +66,7 @@ void Profile::store(QSettings& settings) const
 | 
			
		|||
	settings.setValue(GROUP + QString("/exposureTime"), exposureTime);
 | 
			
		||||
	settings.setValue(GROUP + QString("/name"), name_);
 | 
			
		||||
	settings.setValue(GROUP + QString("/nodistort"), nodistort);
 | 
			
		||||
	settings.setValue(GROUP + QString("/kfact"), kFactor);
 | 
			
		||||
 | 
			
		||||
	if(lightmap.data)
 | 
			
		||||
		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();
 | 
			
		||||
	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());
 | 
			
		||||
 | 
			
		||||
	int size = settings.beginReadArray(GROUP + QString("/cameras"));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,6 +48,7 @@ public:
 | 
			
		|||
	cv::Mat calcurve;
 | 
			
		||||
	std::vector<CameraSetup> cameras;
 | 
			
		||||
	bool nodistort = false;
 | 
			
		||||
	float kFactor = 0;
 | 
			
		||||
 | 
			
		||||
	Profile(const QString& name = "");
 | 
			
		||||
	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->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->checkBoxCh1, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
 | 
			
		||||
	connect(ui->checkBoxCh2, &QCheckBox::clicked, this, &EditProfileDialog::setMask);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -192,25 +192,35 @@
 | 
			
		|||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </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>
 | 
			
		||||
    <layout class="QGridLayout" name="gridLayout">
 | 
			
		||||
     <property name="topMargin">
 | 
			
		||||
      <number>10</number>
 | 
			
		||||
     </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">
 | 
			
		||||
      <widget class="Led" name="calLed" native="true">
 | 
			
		||||
       <property name="sizePolicy">
 | 
			
		||||
| 
						 | 
				
			
			@ -227,6 +237,20 @@
 | 
			
		|||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </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">
 | 
			
		||||
      <widget class="QPushButton" name="pushButtonCalLoad">
 | 
			
		||||
       <property name="sizePolicy">
 | 
			
		||||
| 
						 | 
				
			
			@ -240,10 +264,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="0" column="0">
 | 
			
		||||
      <widget class="QLabel" name="label_7">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Calibration curve:</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
| 
						 | 
				
			
			@ -263,13 +294,6 @@
 | 
			
		|||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </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">
 | 
			
		||||
      <widget class="QPushButton" name="pushButtonLightmapClear">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue