相机参数有效性控制3
This commit is contained in:
tangchao0503
2026-03-20 15:33:25 +08:00
parent 0fb81ab3e8
commit d358989579
5 changed files with 88 additions and 59 deletions

View File

@ -5,20 +5,25 @@ HyperImagerControl::HyperImagerControl(QWidget* parent)
{ {
ui.setupUi(this); ui.setupUi(this);
connect(ui.framerate_lineEdit, &QLineEdit::editingFinished, this, &HyperImagerControl::onFramerateLineEditEditingFinished); connect(ui.framerate_spinBox, &QDoubleSpinBox::editingFinished, this, &HyperImagerControl::onFramerateSpinBoxEditingFinished);
connect(ui.FramerateSlider, &QSlider::valueChanged, this, &HyperImagerControl::onFramerateSliderChanged); connect(ui.FramerateSlider, &QDoubleSlider::valueChanged, this, &HyperImagerControl::onFramerateSliderChanged);
connect(ui.FramerateSlider, &QSlider::sliderReleased, this, &HyperImagerControl::onFramerateSliderReleased); connect(ui.FramerateSlider, &QDoubleSlider::sliderReleased, this, &HyperImagerControl::onFramerateSliderReleased);
connect(ui.integratioin_time_lineEdit, &QLineEdit::editingFinished, this, &HyperImagerControl::onIntegrationTimeLineEditEditingFinished); connect(ui.integratioin_time_spinBox, &QDoubleSpinBox::editingFinished, this, &HyperImagerControl::onIntegrationTimeSpinBoxEditingFinished);
connect(ui.IntegratioinTimeSlider, &QSlider::valueChanged, this, &HyperImagerControl::onIntegrationTimeSliderChanged); connect(ui.IntegratioinTimeSlider, &QDoubleSlider::valueChanged, this, &HyperImagerControl::onIntegrationTimeSliderChanged);
connect(ui.IntegratioinTimeSlider, &QSlider::sliderReleased, this, &HyperImagerControl::onIntegrationTimeSliderReleased); connect(ui.IntegratioinTimeSlider, &QDoubleSlider::sliderReleased, this, &HyperImagerControl::onIntegrationTimeSliderReleased);
connect(ui.gain_lineEdit, &QLineEdit::editingFinished, this, &HyperImagerControl::onGainLineEditEditingFinished); connect(ui.gain_spinBox, &QDoubleSpinBox::editingFinished, this, &HyperImagerControl::onGainSpinBoxEditingFinished);
connect(ui.GainSlider, &QSlider::valueChanged, this, &HyperImagerControl::onGainSliderChanged); connect(ui.GainSlider, &QSlider::valueChanged, this, &HyperImagerControl::onGainSliderChanged);
connect(ui.GainSlider, &QSlider::sliderReleased, this, &HyperImagerControl::onGainSliderReleased); connect(ui.GainSlider, &QSlider::sliderReleased, this, &HyperImagerControl::onGainSliderReleased);
ui.framerate_spinBox->setMinimum(1);
ui.framerate_spinBox->setMaximum(250);
ui.FramerateSlider->setMinimum(1); ui.FramerateSlider->setMinimum(1);
ui.FramerateSlider->setMaximum(250); ui.FramerateSlider->setMaximum(250);
ui.gain_spinBox->setMinimum(0);
ui.gain_spinBox->setMaximum(12);
ui.GainSlider->setMinimum(0); ui.GainSlider->setMinimum(0);
ui.GainSlider->setMaximum(12); ui.GainSlider->setMaximum(12);
} }
@ -29,83 +34,108 @@ HyperImagerControl::~HyperImagerControl()
void HyperImagerControl::setFrameRate(double frameRate) void HyperImagerControl::setFrameRate(double frameRate)
{ {
ui.framerate_lineEdit->setText(QString::number(frameRate, 10, 2)); ui.framerate_spinBox->setValue(frameRate);
ui.FramerateSlider->setValue(frameRate, false); ui.FramerateSlider->setValue(frameRate);
//CalculateIntegratioinTimeRange(frameRate); updateIntegrationTimeRange(frameRate);
} }
void HyperImagerControl::setIntegrationTime(double integrationTime) void HyperImagerControl::setIntegrationTime(double integrationTime)
{ {
ui.integratioin_time_lineEdit->setText(QString::number(integrationTime, 10, 2)); ui.integratioin_time_spinBox->setValue(integrationTime);
ui.IntegratioinTimeSlider->setValue(integrationTime); ui.IntegratioinTimeSlider->setValue(integrationTime);
updateFramerateRange(integrationTime);
} }
void HyperImagerControl::setGain(double gain) void HyperImagerControl::setGain(double gain)
{ {
ui.gain_lineEdit->setText(QString::number(gain, 10, 2)); ui.gain_spinBox->setValue(gain);
ui.GainSlider->setValue(gain); ui.GainSlider->setValue(gain);
} }
void HyperImagerControl::onFramerateLineEditEditingFinished() void HyperImagerControl::onFramerateSpinBoxEditingFinished()
{ {
double value = ui.framerate_lineEdit->text().toDouble(); double framerate = ui.framerate_spinBox->value();
ui.FramerateSlider->setValue(value); ui.FramerateSlider->setValue(framerate);
emit framerateChanged(value); emit framerateChanged(framerate);
} }
void HyperImagerControl::onFramerateSliderChanged(double framerate) void HyperImagerControl::onFramerateSliderChanged(double framerate)
{ {
ui.framerate_lineEdit->setText(QString::number(framerate)); ui.framerate_spinBox->blockSignals(true);
ui.framerate_spinBox->setValue(framerate);
ui.framerate_spinBox->blockSignals(false);
} }
void HyperImagerControl::onFramerateSliderReleased() void HyperImagerControl::onFramerateSliderReleased()
{ {
double framerate = ui.framerate_lineEdit->text().toDouble(); double framerate = ui.framerate_spinBox->value();//<2F><><EFBFBD><EFBFBD><E1B4A5>QDoubleSpinBox::editingFinished<65>źţ<C5BA><C5A3>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD>onFramerateSpinBoxEditingFinished<65>ۺ<EFBFBD><DBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>շ<EFBFBD><D5B7><EFBFBD>framerateChanged<65>źš<C5BA>
emit framerateChanged(framerate); emit framerateChanged(framerate);
} }
void HyperImagerControl::onIntegrationTimeLineEditEditingFinished() void HyperImagerControl::onIntegrationTimeSpinBoxEditingFinished()
{ {
double value = ui.integratioin_time_lineEdit->text().toDouble(); double integrationTime = ui.integratioin_time_spinBox->value();
ui.IntegratioinTimeSlider->setValue(value); ui.IntegratioinTimeSlider->setValue(integrationTime);
emit integrationTimeChanged(value); emit integrationTimeChanged(integrationTime);
} }
void HyperImagerControl::onIntegrationTimeSliderChanged(double integrationTime) void HyperImagerControl::onIntegrationTimeSliderChanged(double integrationTime)
{ {
ui.integratioin_time_lineEdit->setText(QString::number(integrationTime)); ui.integratioin_time_spinBox->blockSignals(true);
ui.integratioin_time_spinBox->setValue(integrationTime);
ui.integratioin_time_spinBox->blockSignals(false);
} }
void HyperImagerControl::onIntegrationTimeSliderReleased() void HyperImagerControl::onIntegrationTimeSliderReleased()
{ {
double integrationTime = ui.integratioin_time_lineEdit->text().toDouble(); double integrationTime = ui.integratioin_time_spinBox->value();
emit integrationTimeChanged(integrationTime); emit integrationTimeChanged(integrationTime);
} }
void HyperImagerControl::onGainLineEditEditingFinished() void HyperImagerControl::onGainSpinBoxEditingFinished()
{ {
double value = ui.gain_lineEdit->text().toDouble(); double gain = ui.gain_spinBox->value();
ui.GainSlider->setValue(value); ui.GainSlider->setValue(gain);
emit gainChanged(value); emit gainChanged(gain);
} }
void HyperImagerControl::onGainSliderChanged(double gain) void HyperImagerControl::onGainSliderChanged(double gain)
{ {
ui.gain_lineEdit->setText(QString::number(gain)); ui.gain_spinBox->blockSignals(true);
ui.gain_spinBox->setValue(gain);
ui.gain_spinBox->blockSignals(false);
} }
void HyperImagerControl::onGainSliderReleased() void HyperImagerControl::onGainSliderReleased()
{ {
double gain = ui.gain_lineEdit->text().toDouble(); double gain = ui.gain_spinBox->value();
emit gainChanged(gain); emit gainChanged(gain);
} }
void HyperImagerControl::CalculateIntegratioinTimeRange(double frameRate) void HyperImagerControl::updateIntegrationTimeRange(double frameRate)
{ {
double range = 1 / frameRate * 1000;//<2F><><EFBFBD><EFBFBD> double maxIntegrationTime = 1.0 / frameRate * 1000.0; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ui.IntegratioinTimeSlider->blockSignals(true);//<2F><>ΪsetMaximum<75><EFBFBD><E1B4A5>valueChanged<65>źţ<C5BA><C5A3><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD>setMaximumǰ<6D><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD> ui.IntegratioinTimeSlider->blockSignals(true);
ui.IntegratioinTimeSlider->setMaximum(range); ui.IntegratioinTimeSlider->setMaximum(maxIntegrationTime);
ui.IntegratioinTimeSlider->blockSignals(false); ui.IntegratioinTimeSlider->blockSignals(false);
ui.integratioin_time_spinBox->blockSignals(true);
ui.integratioin_time_spinBox->setMaximum(maxIntegrationTime);
ui.integratioin_time_spinBox->blockSignals(false);
}
void HyperImagerControl::updateFramerateRange(double integrationTime)
{
double maxFramerate = 1.0 / (integrationTime / 1000.0); // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>(<28><><EFBFBD><EFBFBD>)ת֡<D7AA><D6A1>
ui.FramerateSlider->blockSignals(true);
ui.FramerateSlider->setMaximum(maxFramerate);
ui.FramerateSlider->blockSignals(false);
ui.framerate_spinBox->blockSignals(true);
ui.framerate_spinBox->setMaximum(maxFramerate);
ui.framerate_spinBox->blockSignals(false);
} }

View File

@ -22,26 +22,25 @@ public:
void setIntegrationTime(double integrationTime); void setIntegrationTime(double integrationTime);
void setGain(double gain); void setGain(double gain);
void CalculateIntegratioinTimeRange(double frameRate);
signals: signals:
void framerateChanged(double framerate); void framerateChanged(double framerate);
void integrationTimeChanged(double integrationTime); void integrationTimeChanged(double integrationTime);
void gainChanged(double gain); void gainChanged(double gain);
private Q_SLOTS: private Q_SLOTS:
void onFramerateLineEditEditingFinished(); void onFramerateSpinBoxEditingFinished();
void onFramerateSliderChanged(double framerate); void onFramerateSliderChanged(double framerate);
void onFramerateSliderReleased(); void onFramerateSliderReleased();
void onIntegrationTimeSpinBoxEditingFinished();
void onIntegrationTimeLineEditEditingFinished();
void onIntegrationTimeSliderChanged(double integrationTime); void onIntegrationTimeSliderChanged(double integrationTime);
void onIntegrationTimeSliderReleased(); void onIntegrationTimeSliderReleased();
void onGainSpinBoxEditingFinished();
void onGainLineEditEditingFinished();
void onGainSliderChanged(double gain); void onGainSliderChanged(double gain);
void onGainSliderReleased(); void onGainSliderReleased();
private: private:
void updateIntegrationTimeRange(double frameRate);
void updateFramerateRange(double integrationTime);
Ui::HyperImagerControl ui; Ui::HyperImagerControl ui;
}; };

View File

@ -2,7 +2,7 @@
#include "qDoubleSlider.h" #include "qDoubleSlider.h"
QDoubleSlider::QDoubleSlider(QWidget* pParent /*= NULL*/) : QDoubleSlider::QDoubleSlider(QWidget* pParent /*= NULL*/) :
QSlider(pParent), QSlider(pParent),
m_Multiplier(1.0) m_Multiplier(100.0)
{ {
connect(this, SIGNAL(valueChanged(int)), this, SLOT(notifyValueChanged(int))); connect(this, SIGNAL(valueChanged(int)), this, SLOT(notifyValueChanged(int)));

View File

@ -23,8 +23,8 @@ public:
private slots: private slots:
signals : signals :
void valueChanged(double Value); void valueChanged(double Value);//QSlider<65><72>valueChanged<65>źŵIJ<C5B5><C4B2><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
void rangeChanged(double Min, double Max); void rangeChanged(double Min, double Max);//QSlider<65><72>rangeChanged<65>źŵIJ<C5B5><C4B2><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
private: private:
double m_Multiplier; double m_Multiplier;

View File

@ -186,15 +186,15 @@ QSlider::handle:horizontal:pressed {
<item row="0" column="1"> <item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLineEdit" name="framerate_lineEdit"> <widget class="QDoubleSpinBox" name="framerate_spinBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="styleSheet"> <property name="decimals">
<string notr="true"/> <number>2</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -241,15 +241,15 @@ QSlider::handle:horizontal:pressed {
<item row="1" column="1"> <item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLineEdit" name="integratioin_time_lineEdit"> <widget class="QDoubleSpinBox" name="integratioin_time_spinBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="styleSheet"> <property name="decimals">
<string notr="true"/> <number>2</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -302,20 +302,20 @@ QSlider::handle:horizontal:pressed {
<item row="2" column="1"> <item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLineEdit" name="gain_lineEdit"> <widget class="QDoubleSpinBox" name="gain_spinBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="styleSheet"> <property name="decimals">
<string notr="true"/> <number>2</number>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDoubleSlider" name="GainSlider"> <widget class="QSlider" name="GainSlider">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -335,16 +335,16 @@ QSlider::handle:horizontal:pressed {
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>QDoubleSlider</class>
<extends>QSlider</extends>
<header>qdoubleslider.h</header>
</customwidget>
<customwidget> <customwidget>
<class>AspectRatioLabel</class> <class>AspectRatioLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header>AspectRatioLabel.h</header> <header>AspectRatioLabel.h</header>
</customwidget> </customwidget>
<customwidget>
<class>QDoubleSlider</class>
<extends>QSlider</extends>
<header location="global">qdoubleslider.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>