2 Commits

Author SHA1 Message Date
d358989579 fix:
相机参数有效性控制3
2026-03-20 15:33:25 +08:00
0fb81ab3e8 相机参数有效性控制2 2026-03-20 11:52:32 +08:00
9 changed files with 589 additions and 432 deletions

View File

@ -93,27 +93,6 @@ HPPA::HPPA(QWidget* parent)
ui.splitter->setStretchFactor(2, 3);*/
initMenubarToolbar();
//光谱仪操作
m_Imager = nullptr;
m_RecordState = 0;
connect(this->ui.action_connect_imager, SIGNAL(triggered()), this, SLOT(onconnect()));//信号与槽连接相机相机操作相关信号与槽绑定放在函数onconnect中
//设置相机可用帧率范围这些设置必须在slider的信号和槽连接connect前否则setMinimum会改变slider的值
ui.FramerateSlider->setMinimum(1);
ui.FramerateSlider->setMaximum(250);
ui.GainSlider->setMinimum(0);
ui.GainSlider->setMaximum(24);
//相机参数控件设置为不可用
frame_number->setEnabled(false);
ui.framerate_lineEdit->setEnabled(false);
ui.integratioin_time_lineEdit->setEnabled(false);
ui.gain_lineEdit->setEnabled(false);
ui.FramerateSlider->setEnabled(false);
ui.IntegratioinTimeSlider->setEnabled(false);
ui.GainSlider->setEnabled(false);
startTimer(1000);
@ -572,7 +551,10 @@ sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidt
}
)");
//光谱仪操作
m_Imager = nullptr;
m_RecordState = 0;
connect(this->ui.action_connect_imager, SIGNAL(triggered()), this, SLOT(onconnect()));//信号与槽连接相机相机操作相关信号与槽绑定放在函数onconnect中
createActionGroups();
connect(mImagerGroup, &QActionGroup::triggered, this, &HPPA::selectingImager);
@ -693,6 +675,7 @@ void HPPA::initMenubarToolbar()
}
)");
QAction* action = ui.mainToolBar->insertWidget(ui.action_start_recording, frame_number);
frame_number->setEnabled(false);
m_FilenameLineEdit = new QLineEdit(ui.mainToolBar);
m_FilenameLineEdit->setStyleSheet("QLineEdit{background-color:rgb(255,255,255);}");
@ -801,6 +784,10 @@ QWidget* HPPA::tmp(QWidget* a)
void HPPA::initControlTabwidget()
{
m_hic = new HyperImagerControl();
ui.controlTabWidget->addTab(m_hic, QString::fromLocal8Bit("光谱仪"));
m_hic->setDisabled(true);
//rgb相机
m_RgbCameraThread = new QThread();
m_RgbCamera = new RgbCameraOperation();
@ -962,8 +949,8 @@ void HPPA::updateImagerPicture(const QString& actionName)
}
}
}
ui.imagerPictureLabel->setAttribute(Qt::WA_TranslucentBackground);
ui.imagerPictureLabel->setOriginalPixmap(QPixmap::fromImage(img));
m_hic->imagerPictureLabel()->setAttribute(Qt::WA_TranslucentBackground);
m_hic->imagerPictureLabel()->setOriginalPixmap(QPixmap::fromImage(img));
}
}
}
@ -1305,15 +1292,6 @@ void HPPA::createPlantPhenotypeScenario()
}
void HPPA::CalculateIntegratioinTimeRange()
{
double range = 1 / m_Imager->getFramerate() * 1000;//毫秒
ui.IntegratioinTimeSlider->blockSignals(true);//因为setMaximum会触发valueChanged信号所以调用setMaximum前需要阻断信号
ui.IntegratioinTimeSlider->setMaximum(range);
ui.IntegratioinTimeSlider->blockSignals(false);
}
void HPPA::onStartRecordStep1()
{
QAction* checked = moveplatformActionGroup->checkedAction();
@ -1382,7 +1360,7 @@ void HPPA::onStartRecordStep1()
m_RecordState -= 1;
ui.action_start_recording->setText(QString::fromLocal8Bit("采集"));
ui.action_start_recording->setIcon(QIcon(".//icon//all//record_done.svg"));
ui.action_start_recording->setIcon(QIcon(".//icon//all//record_done.svg"));
//ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
}
return;
@ -1542,52 +1520,24 @@ void HPPA::onActionOpenDirectory()
string directory = fileOperation->getDirectoryFromString();
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(directory)));
}
void HPPA::OnFramerateLineeditEditingFinished()
void HPPA::onFramerateChanged(double framerate)
{
std::cout << "Lineedit设置帧率------------------------------------------" << std::endl;
m_Imager->setFramerate(this->ui.framerate_lineEdit->text().toDouble());
ui.FramerateSlider->setValue(ui.framerate_lineEdit->text().toDouble());
CalculateIntegratioinTimeRange();
m_Imager->setFramerate(framerate);
m_hic->setFrameRate(m_Imager->getFramerate());
}
void HPPA::OnFramerateSliderChanged(double framerate)
void HPPA::onIntegrationTimeChanged(double integrationTime)
{
std::cout << "Slider设置帧率------------------------------------------" << std::endl;
m_Imager->setFramerate(this->ui.framerate_lineEdit->text().toDouble());
ui.framerate_lineEdit->setText(QString::number(framerate));
CalculateIntegratioinTimeRange();
m_Imager->setIntegrationTime(integrationTime);
m_hic->setIntegrationTime(m_Imager->getIntegrationTime());
}
void HPPA::OnIntegratioinTimeEditingFinished()
void HPPA::onGainChanged(double gain)
{
std::cout << "Lineedit设置积分时间------------------------------------------" << std::endl;
m_Imager->setIntegrationTime(this->ui.integratioin_time_lineEdit->text().toDouble());
ui.IntegratioinTimeSlider->setValue(ui.integratioin_time_lineEdit->text().toDouble());
}
void HPPA::OnIntegratioinTimeSliderChanged(double IntegratioinTime)
{
std::cout << "Slider设置积分时间------------------------------------------" << std::endl;
m_Imager->setIntegrationTime(IntegratioinTime);
ui.integratioin_time_lineEdit->setText(QString::number(IntegratioinTime));
}
void HPPA::OnGainEditingFinished()
{
m_Imager->setGain(this->ui.gain_lineEdit->text().toDouble());
ui.GainSlider->setValue(ui.gain_lineEdit->text().toDouble());
}
void HPPA::OnGainSliderChanged(double Gain)
{
m_Imager->setGain(this->ui.gain_lineEdit->text().toDouble());
ui.gain_lineEdit->setText(QString::number(Gain));
m_Imager->setGain(gain);
m_hic->setGain(m_Imager->getGain());
}
void HPPA::onLeftMouseButtonPressed(int x, int y, QVector<double> wavelengths, QVector<double> spectrum)
@ -1905,25 +1855,13 @@ void HPPA::onconnect()
connect(this->ui.actionOpenDirectory, SIGNAL(triggered()), this, SLOT(onActionOpenDirectory()));
connect(this->ui.framerate_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnFramerateLineeditEditingFinished()));
connect(this->ui.FramerateSlider, SIGNAL(valueChanged(double)), this, SLOT(OnFramerateSliderChanged(double)));
connect(this->ui.integratioin_time_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnIntegratioinTimeEditingFinished()));
connect(this->ui.IntegratioinTimeSlider, SIGNAL(valueChanged(double)), this, SLOT(OnIntegratioinTimeSliderChanged(double)));
connect(this->ui.gain_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnGainEditingFinished()));
connect(this->ui.GainSlider, SIGNAL(valueChanged(double)), this, SLOT(OnGainSliderChanged(double)));
connect(m_hic, SIGNAL(framerateChanged(double)), this, SLOT(onFramerateChanged(double)));
connect(m_hic, SIGNAL(integrationTimeChanged(double)), this, SLOT(onIntegrationTimeChanged(double)));
connect(m_hic, SIGNAL(gainChanged(double)), this, SLOT(onGainChanged(double)));
//相机参数控件设置为可用 + 输入控制
frame_number->setEnabled(true);
ui.framerate_lineEdit->setEnabled(true);
ui.integratioin_time_lineEdit->setEnabled(true);
ui.gain_lineEdit->setEnabled(true);
ui.FramerateSlider->setEnabled(true);
ui.IntegratioinTimeSlider->setEnabled(true);
ui.GainSlider->setEnabled(true);
m_hic->setDisabled(false);
/*QRegExp rx("\\d{0,3}[1-9]$");
ui.framerate_lineEdit->setValidator(new QRegExpValidator(rx));
@ -1933,15 +1871,9 @@ void HPPA::onconnect()
ui.gain_lineEdit->setValidator(new QRegExpValidator(rx));*/
//获取相机参数并显示到界面中
ui.framerate_lineEdit->setText(QString::number(m_Imager->getFramerate(), 10, 2));
ui.FramerateSlider->setValue(m_Imager->getFramerate(), true);
CalculateIntegratioinTimeRange();
ui.integratioin_time_lineEdit->setText(QString::number(m_Imager->getIntegrationTime(), 10, 2));
ui.IntegratioinTimeSlider->setValue(m_Imager->getIntegrationTime());
ui.gain_lineEdit->setText(QString::number(m_Imager->getGain(), 10, 2));
ui.GainSlider->setValue(m_Imager->getGain());
m_hic->setFrameRate(m_Imager->getFramerate());
m_hic->setIntegrationTime(m_Imager->getIntegrationTime());
m_hic->setGain(m_Imager->getGain());
}
catch (std::exception const& e)
{
@ -1979,7 +1911,7 @@ void HPPA::onAutoExposure()
double ReturnedExposureTime = m_Imager->auto_exposure();
//将自动曝光所得的值显示到界面
ui.IntegratioinTimeSlider->setValue(ReturnedExposureTime, false);
m_hic->setIntegrationTime(ReturnedExposureTime);
//ui.mainToolBar->widgetForAction(ui.action_auto_exposure)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
}

View File

@ -69,6 +69,8 @@
#include "AspectRatioLabel.h"
#include "HyperImagerControl.h"
#define PI 3.1415926
QT_CHARTS_USE_NAMESPACE//QChartView 使用 需要加宏, 否则无法使用
@ -186,8 +188,6 @@ public:
static HPPA* instance();
LayerTreeNode* rasterGroupNode() const;
void CalculateIntegratioinTimeRange();//通过帧率计算积分时间范围设置slider最大值
WorkerThread * m_TestImagerStausThread;//检测相机连接状态的线程
private:
@ -267,6 +267,7 @@ private:
TabManager* m_tabManager;
HyperImagerControl* m_hic;
ImageControl* m_ic;
adjustTable* m_adt;
PowerControl* m_pc;
@ -317,16 +318,12 @@ public Q_SLOTS:
void onTabWidgetCurrentChanged(int index);
void onActionOpenDirectory();
void OnFramerateLineeditEditingFinished();//
void OnFramerateSliderChanged(double framerate);//
void onFramerateChanged(double framerate);
void onIntegrationTimeChanged(double integrationTime);
void onGainChanged(double gain);
void OnIntegratioinTimeEditingFinished();//
void OnIntegratioinTimeSliderChanged(double IntegratioinTime);//
void OnGainEditingFinished();//
void OnGainSliderChanged(double Gain);//
void onLeftMouseButtonPressed(int x, int y, QVector<double> wavelengths, QVector<double> spectrum);//点击影像像元显示光谱
void setAxis(QValueAxis* axisX, QValueAxis* axisY);
void onLeftMouseButtonPressed(int x, int y, QVector<double> wavelengths, QVector<double> spectrum);//点击影像像元显示光谱
void setAxis(QValueAxis* axisX, QValueAxis* axisY);
void timerEvent(QTimerEvent *event);

View File

@ -327,318 +327,6 @@ QTabWidget::pane {
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
<widget class="QWidget" name="tab">
<property name="styleSheet">
<string notr="true">
QLineEdit {
background-color: #142D7F;
color: #e6eeff;
border: 1px solid #2f6bff;
border-radius: 6px;
padding: 4px 8px;
min-width: 70px;
min-height: 20px;
font-size: 13px;
}
QLineEdit:hover {
border: 1px solid #4d8dff;
}
QLineEdit:focus {
border: 1px solid #6aa2ff;
background-color: #23345c;
}
QSlider::groove:horizontal {
height: 10px;
background: #1e2a44;
border-radius: 3px;
}
/* 已滑过:渐变蓝 */
QSlider::sub-page:horizontal {
background: qlineargradient(
x1:0, y1:0, x2:1, y2:0,
stop:0 #1f4fff,
stop:0.5 #2f6bff,
stop:1 #5fa0ff
);
border-radius: 3px;
}
/* 未滑过 */
QSlider::add-page:horizontal {
height: 10px;
background: #2a3550;
border-radius: 3px;
}
/* ===== 滑块按钮 ===== */
QSlider::handle:horizontal {
width: 15px;
height: 10px;
/* 蓝色实心 */
background: #2f6bff;
/* 白色外圈 */
border: 2px solid #ffffff;
border-radius: 5px;
/* 垂直居中 */
margin: -5px 0;
}
/* 悬停 */
QSlider::handle:horizontal:hover {
background: #4d8dff;
}
/* 按下 */
QSlider::handle:horizontal:pressed {
background: #1f4fff;
}</string>
</property>
<attribute name="title">
<string>光谱仪</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<property name="spacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="AspectRatioLabel" name="imagerPictureLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QWidget" name="widget_3" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>帧率</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="framerate_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSlider" name="FramerateSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>积分时间</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="integratioin_time_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSlider" name="IntegratioinTimeSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>gain</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="gain_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSlider" name="GainSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="rgbCameraWidget">
<property name="styleSheet">
<string notr="true">QGroupBox
@ -1147,11 +835,6 @@ QPushButton:pressed
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QDoubleSlider</class>
<extends>QSlider</extends>
<header>qdoubleslider.h</header>
</customwidget>
<customwidget>
<class>CustomDockWidgetBase</class>
<extends>QDockWidget</extends>
@ -1164,11 +847,6 @@ QPushButton:pressed
<header>CustomDockWidgetBase.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>AspectRatioLabel</class>
<extends>QLabel</extends>
<header>AspectRatioLabel.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="HPPA.qrc"/>

View File

@ -112,6 +112,7 @@
<ClCompile Include="Corning410Imager.cpp" />
<ClCompile Include="CustomDockWidgetBase.cpp" />
<ClCompile Include="hppaConfigFile.cpp" />
<ClCompile Include="HyperImagerControl.cpp" />
<ClCompile Include="imageControl.cpp" />
<ClCompile Include="ImagerOperationBase.cpp" />
<ClCompile Include="imager_base.cpp" />
@ -166,6 +167,7 @@
<ClCompile Include="imagerSimulatioin.cpp" />
<ClCompile Include="ImageViewer.cpp" />
<ClCompile Include="main.cpp" />
<QtUic Include="hyperImagerControl.ui" />
<QtUic Include="imgControl.ui" />
<QtUic Include="oneMotorControl.ui" />
<QtUic Include="PathPlan.ui" />
@ -196,6 +198,7 @@
<QtMoc Include="Carousel.h" />
<QtMoc Include="imageControl.h" />
<QtMoc Include="AspectRatioLabel.h" />
<QtMoc Include="HyperImagerControl.h" />
<ClInclude Include="imager_base.h" />
<ClInclude Include="irisximeaimager.h" />
<QtMoc Include="OneMotorControl.h" />

View File

@ -193,6 +193,9 @@
<ClCompile Include="AspectRatioLabel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="HyperImagerControl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="fileOperation.h">
@ -312,6 +315,9 @@
<QtMoc Include="AspectRatioLabel.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="HyperImagerControl.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<ClInclude Include="imageProcessor.h">
@ -388,6 +394,9 @@
<QtUic Include="imgControl.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="hyperImagerControl.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

141
HPPA/HyperImagerControl.cpp Normal file
View File

@ -0,0 +1,141 @@
#include "HyperImagerControl.h"
HyperImagerControl::HyperImagerControl(QWidget* parent)
: QDialog(parent)
{
ui.setupUi(this);
connect(ui.framerate_spinBox, &QDoubleSpinBox::editingFinished, this, &HyperImagerControl::onFramerateSpinBoxEditingFinished);
connect(ui.FramerateSlider, &QDoubleSlider::valueChanged, this, &HyperImagerControl::onFramerateSliderChanged);
connect(ui.FramerateSlider, &QDoubleSlider::sliderReleased, this, &HyperImagerControl::onFramerateSliderReleased);
connect(ui.integratioin_time_spinBox, &QDoubleSpinBox::editingFinished, this, &HyperImagerControl::onIntegrationTimeSpinBoxEditingFinished);
connect(ui.IntegratioinTimeSlider, &QDoubleSlider::valueChanged, this, &HyperImagerControl::onIntegrationTimeSliderChanged);
connect(ui.IntegratioinTimeSlider, &QDoubleSlider::sliderReleased, this, &HyperImagerControl::onIntegrationTimeSliderReleased);
connect(ui.gain_spinBox, &QDoubleSpinBox::editingFinished, this, &HyperImagerControl::onGainSpinBoxEditingFinished);
connect(ui.GainSlider, &QSlider::valueChanged, this, &HyperImagerControl::onGainSliderChanged);
connect(ui.GainSlider, &QSlider::sliderReleased, this, &HyperImagerControl::onGainSliderReleased);
ui.framerate_spinBox->setMinimum(1);
ui.framerate_spinBox->setMaximum(250);
ui.FramerateSlider->setMinimum(1);
ui.FramerateSlider->setMaximum(250);
ui.gain_spinBox->setMinimum(0);
ui.gain_spinBox->setMaximum(12);
ui.GainSlider->setMinimum(0);
ui.GainSlider->setMaximum(12);
}
HyperImagerControl::~HyperImagerControl()
{
}
void HyperImagerControl::setFrameRate(double frameRate)
{
ui.framerate_spinBox->setValue(frameRate);
ui.FramerateSlider->setValue(frameRate);
updateIntegrationTimeRange(frameRate);
}
void HyperImagerControl::setIntegrationTime(double integrationTime)
{
ui.integratioin_time_spinBox->setValue(integrationTime);
ui.IntegratioinTimeSlider->setValue(integrationTime);
updateFramerateRange(integrationTime);
}
void HyperImagerControl::setGain(double gain)
{
ui.gain_spinBox->setValue(gain);
ui.GainSlider->setValue(gain);
}
void HyperImagerControl::onFramerateSpinBoxEditingFinished()
{
double framerate = ui.framerate_spinBox->value();
ui.FramerateSlider->setValue(framerate);
emit framerateChanged(framerate);
}
void HyperImagerControl::onFramerateSliderChanged(double framerate)
{
ui.framerate_spinBox->blockSignals(true);
ui.framerate_spinBox->setValue(framerate);
ui.framerate_spinBox->blockSignals(false);
}
void HyperImagerControl::onFramerateSliderReleased()
{
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);
}
void HyperImagerControl::onIntegrationTimeSpinBoxEditingFinished()
{
double integrationTime = ui.integratioin_time_spinBox->value();
ui.IntegratioinTimeSlider->setValue(integrationTime);
emit integrationTimeChanged(integrationTime);
}
void HyperImagerControl::onIntegrationTimeSliderChanged(double integrationTime)
{
ui.integratioin_time_spinBox->blockSignals(true);
ui.integratioin_time_spinBox->setValue(integrationTime);
ui.integratioin_time_spinBox->blockSignals(false);
}
void HyperImagerControl::onIntegrationTimeSliderReleased()
{
double integrationTime = ui.integratioin_time_spinBox->value();
emit integrationTimeChanged(integrationTime);
}
void HyperImagerControl::onGainSpinBoxEditingFinished()
{
double gain = ui.gain_spinBox->value();
ui.GainSlider->setValue(gain);
emit gainChanged(gain);
}
void HyperImagerControl::onGainSliderChanged(double gain)
{
ui.gain_spinBox->blockSignals(true);
ui.gain_spinBox->setValue(gain);
ui.gain_spinBox->blockSignals(false);
}
void HyperImagerControl::onGainSliderReleased()
{
double gain = ui.gain_spinBox->value();
emit gainChanged(gain);
}
void HyperImagerControl::updateIntegrationTimeRange(double frameRate)
{
double maxIntegrationTime = 1.0 / frameRate * 1000.0; // <20><><EFBFBD><EFBFBD>
ui.IntegratioinTimeSlider->blockSignals(true);
ui.IntegratioinTimeSlider->setMaximum(maxIntegrationTime);
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);
}

46
HPPA/HyperImagerControl.h Normal file
View File

@ -0,0 +1,46 @@
#pragma once
#include <QDialog>
#include "ui_hyperImagerControl.h"
#include "AspectRatioLabel.h"
class QDoubleSlider;
class HyperImagerControl : public QDialog
{
Q_OBJECT
public:
HyperImagerControl(QWidget* parent = nullptr);
~HyperImagerControl();
AspectRatioLabel* imagerPictureLabel() const { return ui.imagerPictureLabel; }
void setFrameRate(double frameRate);
void setIntegrationTime(double integrationTime);
void setGain(double gain);
signals:
void framerateChanged(double framerate);
void integrationTimeChanged(double integrationTime);
void gainChanged(double gain);
private Q_SLOTS:
void onFramerateSpinBoxEditingFinished();
void onFramerateSliderChanged(double framerate);
void onFramerateSliderReleased();
void onIntegrationTimeSpinBoxEditingFinished();
void onIntegrationTimeSliderChanged(double integrationTime);
void onIntegrationTimeSliderReleased();
void onGainSpinBoxEditingFinished();
void onGainSliderChanged(double gain);
void onGainSliderReleased();
private:
void updateIntegrationTimeRange(double frameRate);
void updateFramerateRange(double integrationTime);
Ui::HyperImagerControl ui;
};

View File

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

351
HPPA/hyperImagerControl.ui Normal file
View File

@ -0,0 +1,351 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HyperImagerControl</class>
<widget class="QWidget" name="HyperImagerControl">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>462</width>
<height>385</height>
</rect>
</property>
<property name="windowTitle">
<string>Color Adjust</string>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox
{
border: 12px solid transparent;
/*border-top: 12px solid transparent;
border-right: 0px solid transparent;
border-bottom: 0px solid transparent;
border-left: 0px solid transparent;*/
color: #ACCDFF;
}
QPushButton
{
/*width: 172px;
height: 56px;*/
font: 10pt &quot;新宋体&quot;;
background-color: qlineargradient(
spread:pad,
x1:0.5, y1:0, x2:0.5, y2:1,
stop:0 #283D86,
stop:1 #0F1A40
);
color: white;
border: none;
padding: 8px 8px;
border-radius: 4px;
}
QPushButton:hover
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #3A4875,
stop:1 #5F6B91
);
}
/* 按下时的效果 */
QPushButton:pressed
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #1A254F,
stop:1 #3A466B
);
/* 可选:添加下压效果 */
padding-top: 9px;
padding-bottom: 7px;
}
QLabel {
color: rgb(255, 255, 255);
}
QSlider::groove:horizontal {
height: 10px;
background: #1e2a44;
border-radius: 3px;
}
/* 已滑过:渐变蓝 */
QSlider::sub-page:horizontal {
background: qlineargradient(
x1:0, y1:0, x2:1, y2:0,
stop:0 #1f4fff,
stop:0.5 #2f6bff,
stop:1 #5fa0ff
);
border-radius: 3px;
}
/* 未滑过 */
QSlider::add-page:horizontal {
height: 10px;
background: #2a3550;
border-radius: 3px;
}
/* ===== 滑块按钮 ===== */
QSlider::handle:horizontal {
width: 15px;
height: 10px;
/* 蓝色实心 */
background: #2f6bff;
/* 白色外圈 */
border: 2px solid #ffffff;
border-radius: 5px;
/* 垂直居中 */
margin: -5px 0;
}
/* 悬停 */
QSlider::handle:horizontal:hover {
background: #4d8dff;
}
/* 按下 */
QSlider::handle:horizontal:pressed {
background: #1f4fff;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="AspectRatioLabel" name="imagerPictureLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QWidget" name="widget_3" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>帧率</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QDoubleSpinBox" name="framerate_spinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>2</number>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSlider" name="FramerateSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>积分时间</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QDoubleSpinBox" name="integratioin_time_spinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>2</number>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSlider" name="IntegratioinTimeSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>gain</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QDoubleSpinBox" name="gain_spinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>2</number>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="GainSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AspectRatioLabel</class>
<extends>QLabel</extends>
<header>AspectRatioLabel.h</header>
</customwidget>
<customwidget>
<class>QDoubleSlider</class>
<extends>QSlider</extends>
<header location="global">qdoubleslider.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>