From cbc81cb75ebeeb65cd31cc37dad547b7d52ad029 Mon Sep 17 00:00:00 2001 From: tangchao0503 <735056338@qq.com> Date: Wed, 25 Dec 2024 15:51:10 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81QMotorDoubleSlider=20=E5=B0=86?= =?UTF-8?q?=E7=BB=86=E5=88=86=E5=8F=82=E6=95=B0=E5=92=8C=20Vince=20?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=EF=BC=8C=E4=BD=BF=E7=94=A87=E4=BB=A3?= =?UTF-8?q?=E8=A1=A8128=EF=BC=8C=E5=B9=B6=E4=BF=AE=E6=94=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E7=B1=BB=E7=9A=84=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=9B=202=E3=80=81resonon=20nir=20?= =?UTF-8?q?=E9=87=87=E9=9B=86=E7=99=BD=E6=9D=BF=E5=B4=A9=E6=BA=83=EF=BC=9A?= =?UTF-8?q?=E9=87=8D=E8=BF=9E=E7=9B=B8=E6=9C=BA=E8=A7=A3=E5=86=B3=EF=BC=9B?= =?UTF-8?q?=203=E3=80=81=E5=8E=BB=E6=8E=89=20imageViewer=20=E7=9A=84?= =?UTF-8?q?=E8=BE=B9=E7=BC=98=E9=BB=91=E6=A1=86=EF=BC=9B=204=E3=80=81?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=97=AE=E9=A2=98=EF=BC=9A=E5=BD=93=E9=87=87?= =?UTF-8?q?=E9=9B=86=E7=99=BD=E6=9D=BF=E6=95=B0=E6=8D=AE=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E9=87=87=E9=9B=86=E5=BD=B1=E5=83=8F=E6=8B=89=E4=BC=B8=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9A=E7=A1=AC=E7=BC=96=E7=A0=81=E7=9A=844096=20?= =?UTF-8?q?=E2=86=92=20=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E5=80=BC=EF=BC=9B=205=E3=80=81=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=B8=8A=E6=AC=A1=E8=BD=AF=E4=BB=B6=E5=B8=83=E5=B1=80=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=89=93?= =?UTF-8?q?=E5=BC=80=E6=97=B6=E6=81=A2=E5=A4=8D=EF=BC=9B=206=E3=80=81?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=A7=84=E5=88=92=E7=95=8C=E9=9D=A2=E6=96=87?= =?UTF-8?q?=E5=AD=97=E5=B1=85=E4=B8=AD=EF=BC=9B=207=E3=80=81=E5=B0=86=20gr?= =?UTF-8?q?oupbox=20=E6=8D=A2=E6=88=90=20dockwidget=EF=BC=8C=E7=84=B6?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E8=8F=9C=E5=8D=95=E6=A0=8F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20dock=20=E7=9A=84=E5=BC=80=E5=85=B3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HPPA/HPPA.cpp | 156 +- HPPA/HPPA.h | 6 + HPPA/HPPA.ui | 3672 ++++++++++++++++++----------------- HPPA/ImageViewer.cpp | 1 + HPPA/QMotorDoubleSlider.cpp | 22 +- HPPA/QMotorDoubleSlider.h | 3 +- HPPA/ResononNirImager.cpp | 38 + HPPA/ResononNirImager.h | 2 + HPPA/about.ui | 8 +- HPPA/hppaConfigFile.cpp | 4 +- HPPA/image2display.cpp | 3 +- HPPA/image2display.h | 1 + HPPA/imageProcessor.cpp | 8 +- 13 files changed, 2093 insertions(+), 1831 deletions(-) diff --git a/HPPA/HPPA.cpp b/HPPA/HPPA.cpp index 5def0de..589f8f8 100644 --- a/HPPA/HPPA.cpp +++ b/HPPA/HPPA.cpp @@ -15,36 +15,46 @@ HPPA::HPPA(QWidget *parent) { ui.setupUi(this); + QString strPath = QCoreApplication::applicationDirPath() + "/UILayout.ini"; + QFile file(strPath); + if (file.open(QIODevice::ReadOnly)) { + QByteArray ba; + QDataStream in(&file); + in >> ba; + file.close(); + this->restoreState(ba); + } + //配置文件:如果没有,就创建配置文件 string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg"; - configfile.setConfigfilePath(HPPACfgFile); - if (!configfile.isConfigfileExist()) + mConfigfile.setConfigfilePath(HPPACfgFile); + if (!mConfigfile.isConfigfileExist()) { - configfile.createConfigFile(); + mConfigfile.createConfigFile(); qDebug() << "create: " << QString::fromStdString(HPPACfgFile); } - configfile.parseConfigfile(); + mConfigfile.parseConfigfile(); qDebug() << "exist: " << QString::fromStdString(HPPACfgFile); /*int max, min; - configfile.getPositionRestriction(max, min); + mConfigfile.getPositionRestriction(max, min); string sn; - configfile.getSN(sn); + mConfigfile.getSN(sn); int coarse, fine; - configfile.getTuningStepSize(coarse, fine); + mConfigfile.getTuningStepSize(coarse, fine); float fa, fb; - configfile.getFitParams(fa, fb); + mConfigfile.getFitParams(fa, fb); int max_FocusRange, min_FocusRange; - configfile.getAutoFocusRange(max_FocusRange, min_FocusRange); + mConfigfile.getAutoFocusRange(max_FocusRange, min_FocusRange); float StepAnglemar_x, Lead_x, ScaleFactor_x; int SubdivisionMultiples_x; - configfile.getXMotorParm(StepAnglemar_x, Lead_x, SubdivisionMultiples_x, ScaleFactor_x); + mConfigfile.getXMotorParm(StepAnglemar_x, Lead_x, SubdivisionMultiples_x, ScaleFactor_x); float StepAnglemar_y, Lead_y, ScaleFactor_y; int SubdivisionMultiples_y; - configfile.getYMotorParm(StepAnglemar_y, Lead_y, SubdivisionMultiples_y, ScaleFactor_y);*/ + mConfigfile.getYMotorParm(StepAnglemar_y, Lead_y, SubdivisionMultiples_y, ScaleFactor_y);*/ //状态栏 xmotor_state_label1 = new QLabel(); @@ -87,9 +97,18 @@ HPPA::HPPA(QWidget *parent) //用于显示光谱 - m_chartView = new QChartView(); + QWidget* widget = new QWidget(); + QGridLayout* grid = new QGridLayout(widget); + + + m_chartView = new QChartView(ui.mDockWidgetSpectralViewer); m_chartView->setRenderHint(QPainter::Antialiasing); - ui.spectral_gridLayout->addWidget(m_chartView); + + grid->addWidget(m_chartView); + //grid->setMargin(0); + grid->setContentsMargins(0, 0, 0, 0); + //grid->SetMaximumSize(0); + ui.mDockWidgetSpectralViewer->setWidget(widget); //QLineSeries *series = new QLineSeries(); //QChart *chart = new QChart(); @@ -170,7 +189,7 @@ HPPA::HPPA(QWidget *parent) float scaleFactor;//因机械装置的原因引入的缩放因子 int subdivisionMultiples;//细分数 float maxRange; - configfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); + mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); ui.xmotor_speed_slider->setMultiplier(lead, stepAnglemar, scaleFactor, subdivisionMultiples); ui.xmotor_speed_slider->setRange(0, 3);//5.2734375cm/s=10000脉冲 @@ -185,7 +204,7 @@ HPPA::HPPA(QWidget *parent) ui.xmotor_location_slider->setMultiplier(lead, stepAnglemar, scaleFactor, subdivisionMultiples); ui.xmotor_location_slider->setValue(0); - configfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); + mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); connect(this->ui.ymotor_location_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnYmotorLocationLineeditEditingFinished())); connect(this->ui.ymotor_location_slider, SIGNAL(valueChanged(double)), this, SLOT(OnYmotorLocationSliderChanged(double))); connect(this->ui.ymotor_location_slider, SIGNAL(sliderReleased()), this, SLOT(OnYmotorLocationSliderReleased())); @@ -283,6 +302,8 @@ HPPA::HPPA(QWidget *parent) createActionGroups(); connect(mImagerGroup, &QActionGroup::triggered, this, &HPPA::selectingImager); + + initPanelToolbar(); } void HPPA::createActionGroups() @@ -305,6 +326,15 @@ void HPPA::selectingImager(QAction* selectedAction) HPPA::~HPPA() { + QString strPath = QCoreApplication::applicationDirPath() + "/UILayout.ini"; + QFile file(strPath); + if (file.open(QIODevice::WriteOnly)) { + QDataStream outfile(&file); + QByteArray ba = this->saveState(); + outfile << ba; + file.close(); + } + if (m_Imager != nullptr) { //m_Imager->~ResononNirImager();//释放资源 @@ -324,6 +354,33 @@ HPPA::~HPPA() } } +void HPPA::initPanelToolbar() +{ + tabifyDockWidget(ui.mDockWidgetSpectrometer, ui.mDockWidgetLinearStage); + tabifyDockWidget(ui.mDockWidgetLinearStage, ui.mDockWidgetPathPlanning); + tabifyDockWidget(ui.mDockWidgetPathPlanning, ui.mDockWidgetPowerControl); + tabifyDockWidget(ui.mDockWidgetPowerControl, ui.mDockWidgetAdjustTable); + + mPanelMenu = new QMenu(QString::fromLocal8Bit("面板"), this);//create panel menu + mPanelMenu->setObjectName(QStringLiteral("mPanelMenu")); + mToolbarMenu = new QMenu(QString::fromLocal8Bit("工具栏"), this);//create toolbar menu + mToolbarMenu->setObjectName(QStringLiteral("mToolbarMenu")); + + ui.mWindowsMenu->addSeparator(); + ui.mWindowsMenu->addMenu(mPanelMenu); + ui.mWindowsMenu->addMenu(mToolbarMenu); + + mPanelMenu->addAction(ui.mDockWidgetSpectrometer->toggleViewAction()); + mPanelMenu->addAction(ui.mDockWidgetLinearStage->toggleViewAction()); + mPanelMenu->addAction(ui.mDockWidgetPathPlanning->toggleViewAction()); + mPanelMenu->addAction(ui.mDockWidgetPowerControl->toggleViewAction()); + mPanelMenu->addAction(ui.mDockWidgetAdjustTable->toggleViewAction()); + mPanelMenu->addAction(ui.mDockWidgetRGBCamera->toggleViewAction()); + mPanelMenu->addAction(ui.mDockWidgetSimulator->toggleViewAction()); + + mToolbarMenu->addAction(ui.mainToolBar->toggleViewAction()); +} + void HPPA::CalculateIntegratioinTimeRange() { double range = 1 / m_Imager->getFramerate() * 1000;//毫秒 @@ -919,8 +976,8 @@ void HPPA::setMotorRange() float scaleFactor;//因机械装置的原因引入的缩放因子 int subdivisionMultiples;//细分数 - configfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, xMotorRange); - configfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, yMotorRange); + mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, xMotorRange); + mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, yMotorRange); //std::cout << "xMotorRange:" << xMotorRange << std::endl; @@ -1224,20 +1281,22 @@ void HPPA::onAddRecordLine_btn() int currentRow = ui.recordLine_tableWidget->currentRow(); std::cout << "currentRow:" << currentRow << std::endl; + QTableWidgetItem* Item1 = new QTableWidgetItem(QString::number(currentPosOfYmotor, 10, 2)); + QTableWidgetItem* Item2 = new QTableWidgetItem(QString::number(maxRangeOfXmotro, 10, 2)); if (currentRow == -1)//当没有选中行时 { int RowCount = ui.recordLine_tableWidget->rowCount();//Returns the number of rows. 从1开始的 ui.recordLine_tableWidget->insertRow(RowCount);//增加一行,形参是从0开始的 - ui.recordLine_tableWidget->setItem(RowCount, 0, new QTableWidgetItem(QString::number(currentPosOfYmotor, 10, 2))); - ui.recordLine_tableWidget->setItem(RowCount, 1, new QTableWidgetItem(QString::number(maxRangeOfXmotro, 10, 2))); + ui.recordLine_tableWidget->setItem(RowCount, 0, Item1); + ui.recordLine_tableWidget->setItem(RowCount, 1, Item2); } else { ui.recordLine_tableWidget->insertRow(currentRow + 1);//增加一行,形参是从0开始的 - ui.recordLine_tableWidget->setItem(currentRow + 1, 0, new QTableWidgetItem(QString::number(currentPosOfYmotor, 10, 2))); - ui.recordLine_tableWidget->setItem(currentRow + 1, 1, new QTableWidgetItem(QString::number(maxRangeOfXmotro, 10, 2))); + ui.recordLine_tableWidget->setItem(currentRow + 1, 0, Item1); + ui.recordLine_tableWidget->setItem(currentRow + 1, 1, Item2); } } @@ -1293,6 +1352,7 @@ void HPPA::onGenerateRecordLine_btn() //向tableWidget添加行(采集线) + QTableWidgetItem* tmpItem; for (size_t i = 0; i < numberOfRecordLine; i++) { //增加一行 @@ -1302,16 +1362,22 @@ void HPPA::onGenerateRecordLine_btn() //设置yPosition if (tmp > threshold && i == numberOfRecordLine - 1)//设置最后一行的yPosition { - ui.recordLine_tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(yMotorRange, 10, 2))); + tmpItem = new QTableWidgetItem(QString::number(yMotorRange, 10, 2)); + tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + ui.recordLine_tableWidget->setItem(i, 0, tmpItem); } else { double x = swath * i - i * repetitiveLength + offset; - ui.recordLine_tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(x, 10, 2))); + tmpItem = new QTableWidgetItem(QString::number(x, 10, 2)); + tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + ui.recordLine_tableWidget->setItem(i, 0, tmpItem); } //设置x马达最大运动位置 → 值设置为x马达量程 - ui.recordLine_tableWidget->setItem(i, 1, new QTableWidgetItem(QString::number(xMotorRange, 10, 2))); + tmpItem = new QTableWidgetItem(QString::number(xMotorRange, 10, 2)); + tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + ui.recordLine_tableWidget->setItem(i, 1, tmpItem); } @@ -1447,7 +1513,9 @@ void HPPA::onReadRecordLineFile_btn() { for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++) { - ui.recordLine_tableWidget->setItem(i, j, new QTableWidgetItem(QString::number(data[i*ui.recordLine_tableWidget->columnCount() + j], 10, 2))); + QTableWidgetItem* tmp = new QTableWidgetItem(QString::number(data[i * ui.recordLine_tableWidget->columnCount() + j], 10, 2)); + tmp->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + ui.recordLine_tableWidget->setItem(i, j, tmp); } } @@ -1706,6 +1774,9 @@ void HPPA::newMotor() connect(m_xMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setMotorParamMicroscope(VinceControl*))); connect(m_yMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setMotorParamMicroscope(VinceControl*))); } + + connect(m_xMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setXMotorParamFromCfgFile(VinceControl*))); + connect(m_yMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setYMotorParamFromCfgFile(VinceControl*))); m_xConnectCount = 0; m_yConnectCount = 0; @@ -1744,6 +1815,41 @@ void HPPA::setMotorParamMicroscope(VinceControl* motor) motor->GetCommonRetrun(buf); } +void HPPA::setXMotorParamFromCfgFile(VinceControl* motor) +{ + float lead;//瀵肩▼ + float stepAnglemar;//姝ヨ窛瑙 + float scaleFactor;//鍥犳満姊拌缃殑鍘熷洜寮曞叆鐨勭缉鏀惧洜瀛 + int subdivisionMultiples;//缁嗗垎鏁 + float maxRange; + mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); + + QString commonstr; + QByteArray buf; + + commonstr = "cfg mcs=" + QString::number(subdivisionMultiples) + "\n"; + std::string tmp = commonstr.toStdString(); + motor->SendCommandtoMotor(commonstr, "non"); + motor->GetCommonRetrun(buf); +} + +void HPPA::setYMotorParamFromCfgFile(VinceControl* motor) +{ + float lead;//瀵肩▼ + float stepAnglemar;//姝ヨ窛瑙 + float scaleFactor;//鍥犳満姊拌缃殑鍘熷洜寮曞叆鐨勭缉鏀惧洜瀛 + int subdivisionMultiples;//缁嗗垎鏁 + float maxRange; + mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); + + QString commonstr; + QByteArray buf; + + commonstr = "cfg mcs=" + QString::number(subdivisionMultiples) + "\n"; + motor->SendCommandtoMotor(commonstr, "non"); + motor->GetCommonRetrun(buf); +} + void HPPA::deleteMotor() { disconnect(m_xMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString))); diff --git a/HPPA/HPPA.h b/HPPA/HPPA.h index 3e5bbd3..5ba28f4 100644 --- a/HPPA/HPPA.h +++ b/HPPA/HPPA.h @@ -160,6 +160,12 @@ public: private: Ui::HPPAClass ui; + + QMenu* mPanelMenu = nullptr; + QMenu* mToolbarMenu = nullptr; + + void initPanelToolbar(); + QLineEdit * frame_number; QLineEdit * m_FilenameLineEdit; QLabel * xmotor_state_label1; diff --git a/HPPA/HPPA.ui b/HPPA/HPPA.ui index f3adf8d..01925f8 100644 --- a/HPPA/HPPA.ui +++ b/HPPA/HPPA.ui @@ -6,8 +6,8 @@ 0 0 - 1643 - 831 + 1592 + 1142 @@ -21,7 +21,7 @@ - + 0 @@ -38,39 +38,21 @@ 0 - - - Qt::Horizontal + + + + 5 + 0 + - - - - 0 - 0 - - - - - 200 - 0 - - - - - 16777215 - 16777215 - - - - - 0 - 0 - - - - - - + + 1 + + + + Tab 1 + + 0 @@ -86,1755 +68,12 @@ 0 - - - - false - - - QGroupBox { - /* border: 2px solid #3498db; 杈规棰滆壊 */ - border-radius: 5px; /* 鍦嗚 */ - padding: 10px; /* 鍐呰竟璺 */ - background-color: rgb(255, 255, 255); -} - -QGroupBox:title { - subcontrol-position: top left; /* 鏍囬浣嶇疆 */ - padding: 0 10px; /* 鏍囬鍐呰竟璺 */ - font-weight: bold; /* 鏍囬瀛椾綋鍔犵矖 */ - color: #3498db; /* 鏍囬鏂囧瓧棰滆壊 */ -} - - - - - - - - - - 鎵撳紑 - - - - - - - 鍏抽棴 - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - 鎽勫儚澶村叧闂紒 - - - Qt::AlignCenter - - - - - - - - - - - 0 - 0 - - - - QFrame::Box - - - QFrame::Raised - - - - - - - 5 - 0 - - - - 0 - - - - Tab 1 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - Tab 2 - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - background-color: rgb(240, 240, 240); - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Qt::Vertical - - - - - 0 - 1 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - QTabWidget::pane { - border: 1px solid #ccc; /* 閫夐」鍗¢潰鏉胯竟妗嗛鑹 */ - border-radius: 5px; /* 閫夐」鍗¢潰鏉垮渾瑙 */ - -} - -QTabBar::tab { - background: #f0f0f0; /* 閫夐」鍗¤儗鏅鑹 */ - border: 1px solid #ccc; /* 閫夐」鍗¤竟妗嗛鑹 */ - padding: 10px; /* 鍐呰竟璺 */ - border-radius: 5px; /* 閫夐」鍗″渾瑙 */ - font-size:20px; -} - -QTabBar::tab:selected { - background: #3498db; /* 婵娲荤姸鎬侀夐」鍗¤儗鏅鑹 */ - color: white; /* 婵娲荤姸鎬侀夐」鍗℃枃瀛楅鑹 */ -} - - - - 0 - - - - 鍏夎氨浠 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - 甯х巼 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - background-color: rgb(255, 255, 255); - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 20 - - - - - - - - Qt::Horizontal - - - - - - - - - - - - 100 - 16777215 - - - - 绉垎鏃堕棿 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - background-color: rgb(255, 255, 255); - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 20 - - - - - - - - Qt::Horizontal - - - - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - gain - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - background-color: rgb(255, 255, 255); - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 20 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 绾挎у钩鍙 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - QGroupBox{border:none} - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 84 - 19 - - - - - - - - Qt::Horizontal - - - - 84 - 19 - - - - - - - - - 0 - 0 - - - - 鈫0 - - - - - - - Qt::Horizontal - - - - 84 - 19 - - - - - - - - - 0 - 0 - - - - - - - - - - - Qt::Horizontal - - - - 84 - 20 - - - - - - - - - 0 - 0 - - - - 閲忕▼妫娴 - - - - - - - Qt::Horizontal - - - - 66 - 20 - - - - - - - - - 0 - 0 - - - - 鈫0 - - - - - - - Qt::Horizontal - - - - 84 - 20 - - - - - - - - - 0 - 0 - - - - 褰掗浂 - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - 0 - 0 - - - - #QGroupBox{border:none} - - - x椹揪 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 100 - 20 - - - - 閫熷害 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - background-color: rgb(255, 255, 255); - - - 1 - - - Qt::AlignCenter - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 20 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 17 - - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 37 - 17 - - - - - - - - - 16777215 - 33 - - - - 3 - - - Qt::AlignCenter - - - - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 20 - - - - 浣嶇疆 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 16777215 - 33 - - - - background-color: rgb(255, 255, 255); - - - 0 - - - Qt::AlignCenter - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 14 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - QSlider::NoTicks - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 17 - - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 128 - 17 - - - - - - - - nan - - - Qt::AlignCenter - - - - - - - - - - - - - 0 - 0 - - - - - - - y椹揪 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - 浣嶇疆 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 21 - - - - - 16777215 - 33 - - - - background-color: rgb(255, 255, 255); - - - 0 - - - Qt::AlignCenter - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 20 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - QSlider::NoTicks - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 20 - - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 146 - 20 - - - - - - - - nan - - - Qt::AlignCenter - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - 杞ㄨ抗瑙勫垝 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - 0 - - - - - 108 - 0 - - - - 楂樺害 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - 100 - - - Qt::AlignCenter - - - - - - - Qt::LeftToRight - - - 鐢熸垚杞ㄨ抗 - - - - - - - 淇濆瓨杞ㄨ抗 - - - - - - - - - - - - 0 - 0 - - - - - 108 - 0 - - - - 瑙嗗満瑙 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - 17.6 - - - Qt::AlignCenter - - - - - - - 鍒犻櫎杞ㄨ抗 - - - - - - - 璇诲彇杞ㄨ抗 - - - - - - - - - - - - 0 - 0 - - - - - 108 - 0 - - - - 鍋忕Щ - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - 0 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - 骞呭 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 90 - 0 - - - - 0 - - - Qt::AlignCenter - - - true - - - - - - - 娣诲姞 - - - - - - - - - - - - 0 - 0 - - - - - 108 - 0 - - - - 閲嶅鐜(%) - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - 0 - - - Qt::AlignCenter - - - false - - - - - - - 闃堝 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 90 - 0 - - - - 0.7 - - - Qt::AlignCenter - - - false - - - - - - - 绉婚櫎 - - - - - - - - - - - - - 鐢垫簮鎺у埗 - - - - - - - - 鍗ょ礌鐏 - - - - - - - 鎵撳紑 - - - - - - - 鍏抽棴 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 椹 杈 - - - - - - - 鎵撳紑 - - - - - - - 鍏抽棴 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 254 - - - - - - - - - 鍗囬檷鍙 - - - - - - 1鍙峰崌闄嶅彴 - - - - - - - 0 - 0 - - - - 涓婂崌 - - - - - - - - 0 - 0 - - - - 涓嬮檷 - - - - - - - - 0 - 0 - - - - 鍋滄 - - - - - - - - - - 2鍙峰崌闄嶅彴 - - - - - - - 0 - 0 - - - - 涓婂崌 - - - - - - - - 0 - 0 - - - - 涓嬮檷 - - - - - - - - 0 - 0 - - - - 鍋滄 - - - - - - - - - - - - + + + Tab 2 + @@ -1845,31 +84,35 @@ QTabBar::tab:selected { 0 0 - 1643 - 33 + 1592 + 30 QMenuBar{ -background:rgb(255,255,255); +background:#F0F0F0; color:rgb(0,0,0); -font-size:16px; -padding:2px; +font-size:14px; +padding:1px; border:1px solid rgb(165,171,184); } + QMenuBar::item{ -background:rgb(255,255,255); -width:52px; -height:24px; +background:#F0F0F0; +width:30px; +height:15px; } + QMenuBar::item:selected{ background:rgb(185,196,221); } + QMenu{ background:rgb(255,255,255); color:rgb(0,0,0); border:1px solid rgb(165,171,184); } + QMenu::item:selected{ background:rgb(69,123,255); color:white; @@ -1914,8 +157,14 @@ color:white; + + + 绐楀彛 + + + @@ -1925,13 +174,17 @@ color:white; 0 + + 鐩告満鎺у埗 + QToolBar{ - background:rgb(255,255,255); + + background-color: #f5f5f5; color:rgb(0,0,0); } QToolBar QToolButton { - background: rgb(255,255,255); /* 鎸夐挳鑳屾櫙棰滆壊 */ + background: #f5f5f5; /* 鎸夐挳鑳屾櫙棰滆壊 */ font-size:15px; border-radius: 3px; /* 鎸夐挳鍦嗚 */ padding: 4px; /* 鎸夐挳鍐呰竟璺 */ @@ -1968,6 +221,1831 @@ QToolBar QToolButton:hover { + + + /* 鏍囬璁剧疆 */ +QDockWidget::title { + text-align: left; + background-color: rgb(240, 240, 240); + /*padding-left: 35px;*/ +} + + + RGB 鐩告満 + + + 1 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + false + + + QGroupBox { + /* border: 2px solid #3498db; 杈规棰滆壊 */ + border-radius: 5px; /* 鍦嗚 */ + padding: 10px; /* 鍐呰竟璺 */ + background-color: rgb(255, 255, 255); +} + +QGroupBox:title { + subcontrol-position: top left; /* 鏍囬浣嶇疆 */ + padding: 0 10px; /* 鏍囬鍐呰竟璺 */ + font-weight: bold; /* 鏍囬瀛椾綋鍔犵矖 */ + color: #3498db; /* 鏍囬鏂囧瓧棰滆壊 */ +} + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 鎵撳紑 + + + + + + + 鍏抽棴 + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 鎽勫儚澶村叧闂紒 + + + Qt::AlignCenter + + + + + + + + + + + + /* 鏍囬璁剧疆 */ +QDockWidget::title { + text-align: left; + background-color: rgb(240, 240, 240); + /*padding-left: 35px;*/ +} + + + QDockWidget::AllDockWidgetFeatures + + + 绾挎у钩鍙颁綅缃ā鎷 + + + 1 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Raised + + + + + + + + + /* 鏍囬璁剧疆 */ +QDockWidget::title { + text-align: left; + background-color: rgb(240, 240, 240); + /*padding-left: 35px;*/ +} + + + 鍏夎氨鏇茬嚎 + + + 2 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + /* 鏍囬璁剧疆 */ +QDockWidget::title { + text-align: left; + background-color: rgb(240, 240, 240); + /*padding-left: 35px;*/ +} + + + false + + + 鍗囬檷鍙 + + + 2 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 1鍙峰崌闄嶅彴 + + + + + + + 0 + 0 + + + + 涓婂崌 + + + + + + + + 0 + 0 + + + + 涓嬮檷 + + + + + + + + 0 + 0 + + + + 鍋滄 + + + + + + + + + + 2鍙峰崌闄嶅彴 + + + + + + + 0 + 0 + + + + 涓婂崌 + + + + + + + + 0 + 0 + + + + 涓嬮檷 + + + + + + + + 0 + 0 + + + + 鍋滄 + + + + + + + + + + + + /* 鏍囬璁剧疆 */ +QDockWidget::title { + text-align: left; + background-color: rgb(240, 240, 240); + /*padding-left: 35px;*/ +} + + + 鐢垫簮鎺у埗 + + + 2 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + 鍗ょ礌鐏 + + + + + + + 鎵撳紑 + + + + + + + 鍏抽棴 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 椹 杈 + + + + + + + 鎵撳紑 + + + + + + + 鍏抽棴 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 50 + + + + + + + + + + /* 鏍囬璁剧疆 */ +QDockWidget::title { + text-align: left; + background-color: rgb(240, 240, 240); + /*padding-left: 35px;*/ +} + + + + + 杞ㄨ抗瑙勫垝 + + + 2 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + 0 + 0 + + + + + 108 + 0 + + + + 楂樺害 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + 100 + + + Qt::AlignCenter + + + + + + + Qt::LeftToRight + + + 鐢熸垚杞ㄨ抗 + + + + + + + 淇濆瓨杞ㄨ抗 + + + + + + + + + + + + 0 + 0 + + + + + 108 + 0 + + + + 瑙嗗満瑙 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + 17.6 + + + Qt::AlignCenter + + + + + + + 鍒犻櫎杞ㄨ抗 + + + + + + + 璇诲彇杞ㄨ抗 + + + + + + + + + + + + 0 + 0 + + + + + 108 + 0 + + + + 鍋忕Щ + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + 0 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + 骞呭 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 90 + 0 + + + + 0 + + + Qt::AlignCenter + + + true + + + + + + + 娣诲姞 + + + + + + + + + + + + 0 + 0 + + + + + 108 + 0 + + + + 閲嶅鐜(%) + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 闃堝 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 90 + 0 + + + + 0.7 + + + Qt::AlignCenter + + + false + + + + + + + 绉婚櫎 + + + + + + + + + + + + + + /* 鏍囬璁剧疆 */ +QDockWidget::title { + text-align: left; + background-color: rgb(240, 240, 240); + /*padding-left: 35px;*/ +} + + + 鍏夎氨浠 + + + 2 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 100 + 20 + + + + + + + + Qt::Horizontal + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + 甯х巼 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + background-color: rgb(255, 255, 255); + + + + + + + + + + + + 100 + 16777215 + + + + 绉垎鏃堕棿 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + background-color: rgb(255, 255, 255); + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 100 + 20 + + + + + + + + Qt::Horizontal + + + + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + gain + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + background-color: rgb(255, 255, 255); + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 100 + 20 + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + + + + + Qt::Vertical + + + + 20 + 123 + + + + + + + + + + /* 鏍囬璁剧疆 */ +QDockWidget::title { + text-align: left; + background-color: rgb(240, 240, 240); + /*padding-left: 35px;*/ +} + + + false + + + Qt::AllDockWidgetAreas + + + 绾挎у钩鍙 + + + 2 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QGroupBox{border:none} + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 84 + 19 + + + + + + + + Qt::Horizontal + + + + 84 + 19 + + + + + + + + + 0 + 0 + + + + 鈫0 + + + + + + + Qt::Horizontal + + + + 84 + 19 + + + + + + + + + 0 + 0 + + + + + + + + + + + Qt::Horizontal + + + + 84 + 20 + + + + + + + + + 0 + 0 + + + + 閲忕▼妫娴 + + + + + + + Qt::Horizontal + + + + 66 + 20 + + + + + + + + + 0 + 0 + + + + 鈫0 + + + + + + + Qt::Horizontal + + + + 84 + 20 + + + + + + + + + 0 + 0 + + + + 褰掗浂 + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + #QGroupBox{border:none} + + + x椹揪 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + 100 + 20 + + + + 閫熷害 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + background-color: rgb(255, 255, 255); + + + 1 + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 100 + 20 + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 100 + 17 + + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 37 + 17 + + + + + + + + + 16777215 + 33 + + + + 3 + + + Qt::AlignCenter + + + + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 20 + + + + 浣嶇疆 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + 16777215 + 33 + + + + background-color: rgb(255, 255, 255); + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 100 + 14 + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + QSlider::NoTicks + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 100 + 17 + + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 128 + 17 + + + + + + + + nan + + + Qt::AlignCenter + + + + + + + + + + + + + 0 + 0 + + + + + + + y椹揪 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + 浣嶇疆 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 21 + + + + + 16777215 + 33 + + + + background-color: rgb(255, 255, 255); + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 100 + 20 + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + QSlider::NoTicks + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 100 + 20 + + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 146 + 20 + + + + + + + + nan + + + Qt::AlignCenter + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + 閫鍑 @@ -2058,6 +2136,16 @@ QToolBar QToolButton:hover { Pika NIR + + + 闈㈡澘 + + + + + 宸ュ叿鏍 + + diff --git a/HPPA/ImageViewer.cpp b/HPPA/ImageViewer.cpp index ce71e03..3c071a6 100644 --- a/HPPA/ImageViewer.cpp +++ b/HPPA/ImageViewer.cpp @@ -37,6 +37,7 @@ ImageViewer::ImageViewer(QWidget* pParent) :QGraphicsView(pParent) setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setFrameShape(QFrame::NoFrame); } ImageViewer::~ImageViewer() diff --git a/HPPA/QMotorDoubleSlider.cpp b/HPPA/QMotorDoubleSlider.cpp index 464a66d..32ccca3 100644 --- a/HPPA/QMotorDoubleSlider.cpp +++ b/HPPA/QMotorDoubleSlider.cpp @@ -12,12 +12,30 @@ QMotorDoubleSlider::QMotorDoubleSlider(QWidget* pParent /*= NULL*/) :QSlider(pPa m_Multiplier = 0; } -void QMotorDoubleSlider::setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionMultiples) +void QMotorDoubleSlider::setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionParam) { //根据公式将脉冲换算为距离:1脉冲距离(m_Multiplier)=导程/(360/步距角*细分倍数);网址:https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html //m_Multiplier(0.00054496986),//上海农科院,修改前:0.00052734375/5=0.00010546875;修改后准确值为0.000544969862759644,近似为0.00054496986/5=0.000108993972,因为有个机械装置1脉冲距离需要除以5; //m_Multiplier(0.00054496986)//兴安盟农研所 - m_Multiplier = lead / (360 / stepAnglemar * subdivisionMultiples) * scaleFactor; + m_Multiplier = lead / (360 / stepAnglemar * getValidSubdivision(subdivisionParam)) * scaleFactor; +} + +int QMotorDoubleSlider::getValidSubdivision(int subdivisionParam) +{ + if (subdivisionParam == 2) + return 4; + else if (subdivisionParam == 3) + return 8; + else if (subdivisionParam == 4) + return 16; + else if (subdivisionParam == 5) + return 32; + else if (subdivisionParam == 6) + return 64; + else if (subdivisionParam == 7) + return 128; + else if (subdivisionParam == 8) + return 256; } //向外发射 diff --git a/HPPA/QMotorDoubleSlider.h b/HPPA/QMotorDoubleSlider.h index 371afb6..5a383a3 100644 --- a/HPPA/QMotorDoubleSlider.h +++ b/HPPA/QMotorDoubleSlider.h @@ -12,7 +12,8 @@ class QMotorDoubleSlider : public QSlider public: QMotorDoubleSlider(QWidget* pParent = NULL); - void setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionMultiples); + void setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionParam); + int getValidSubdivision(int subdivisionParam); double m_Multiplier;//根据公式将脉冲换算为距离:1脉冲距离(m_Multiplier)=导程/(360/步距角*细分倍数);网址:https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html diff --git a/HPPA/ResononNirImager.cpp b/HPPA/ResononNirImager.cpp index 214dc36..6d78bc8 100644 --- a/HPPA/ResononNirImager.cpp +++ b/HPPA/ResononNirImager.cpp @@ -189,6 +189,44 @@ void ResononNirImager::focus() setIntegrationTime(tmpIntegrationTime); } +void ResononNirImager::record_dark() +{ + std::cout << "采集暗电流!!!!!!!!!" << std::endl; + reConnectImage(); + imagerStartCollect(); + getFrame(dark); + imagerStopCollect(); + + m_HasDark = true; +} + +void ResononNirImager::record_white() +{ + std::cout << "采集暗白板!!!!!!!!!" << std::endl; + reConnectImage(); + imagerStartCollect(); + getFrame(white); + imagerStopCollect(); + + //白板扣暗电流 + if (m_HasDark) + { + for (size_t i = 0; i < m_FrameSize; i++) + { + if (white[i] < dark[i]) + { + white[i] = 0; + } + else + { + white[i] = white[i] - dark[i]; + } + } + } + + m_HasWhite = true; +} + void ResononNirImager::start_record() { using namespace std; diff --git a/HPPA/ResononNirImager.h b/HPPA/ResononNirImager.h index a755ba8..a38239b 100644 --- a/HPPA/ResononNirImager.h +++ b/HPPA/ResononNirImager.h @@ -43,6 +43,8 @@ private: public slots: double auto_exposure(); void focus(); + void record_dark(); + void record_white(); void start_record(); signals: diff --git a/HPPA/about.ui b/HPPA/about.ui index 9dbae74..a4363c6 100644 --- a/HPPA/about.ui +++ b/HPPA/about.ui @@ -9,8 +9,8 @@ 0 0 - 753 - 490 + 756 + 463 @@ -65,12 +65,12 @@ 270 150 - 108 + 141 24 - 鐗堟湰锛1.8 + 鐗堟湰锛1.8.1 diff --git a/HPPA/hppaConfigFile.cpp b/HPPA/hppaConfigFile.cpp index 3355e47..2fc8371 100644 --- a/HPPA/hppaConfigFile.cpp +++ b/HPPA/hppaConfigFile.cpp @@ -303,12 +303,12 @@ bool Configfile::createConfigFile() Setting& x_StepAnglemar = x.add("StepAnglemar", Setting::TypeFloat) = 1.8;//步距角 Setting& x_Lead = x.add("Lead", Setting::TypeFloat) = 13.5;//导程,单位:cm - Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 128;//细分倍数 + Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 7;//细分倍数 Setting& x_ScaleFactor = x.add("ScaleFactor", Setting::TypeFloat) = 1.0;//缩放因子 Setting& x_MaxRange = x.add("MaxRange", Setting::TypeFloat) = 120.0; Setting& y_StepAnglemar = y.add("StepAnglemar", Setting::TypeFloat) = 1.8; Setting& y_Lead = y.add("Lead", Setting::TypeFloat) = 13.5; - Setting& y_SubdivisionMultiples = y.add("SubdivisionMultiples", Setting::TypeInt) = 128; + Setting& y_SubdivisionMultiples = y.add("SubdivisionMultiples", Setting::TypeInt) = 7; Setting& y_ScaleFactor = y.add("ScaleFactor", Setting::TypeFloat) = 0.2; Setting& y_MaxRange = y.add("MaxRange", Setting::TypeFloat) = 120.0; diff --git a/HPPA/image2display.cpp b/HPPA/image2display.cpp index 971bff6..cc94333 100644 --- a/HPPA/image2display.cpp +++ b/HPPA/image2display.cpp @@ -113,8 +113,9 @@ void CImage::FillRgbImage(unsigned short *datacube) //m_QRgbImage->save(QString::fromStdString(rgbFilePathNoStrech), "PNG"); + //ImageProcessor imageProcessor; //cv::imwrite(rgbFilePathNoStrech, *m_matRgbImage); - //cv::imwrite(rgbFilePathStrech, CStretch(*m_matRgbImage, 0.01)); + //cv::imwrite(rgbFilePathStrech, imageProcessor.CStretch(*m_matRgbImage, 0.02)); } } diff --git a/HPPA/image2display.h b/HPPA/image2display.h index 5d7594a..e5257c8 100644 --- a/HPPA/image2display.h +++ b/HPPA/image2display.h @@ -11,6 +11,7 @@ #include "QImage" #include "fileOperation.h" +#include "imageProcessor.h" class CImage :public QObject diff --git a/HPPA/imageProcessor.cpp b/HPPA/imageProcessor.cpp index 6bce098..1c51da5 100644 --- a/HPPA/imageProcessor.cpp +++ b/HPPA/imageProcessor.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "imageProcessor.h" +#include ImageProcessor::ImageProcessor() { @@ -14,8 +15,9 @@ std::vector ImageProcessor::CHistogram(const cv::Mat img) cv::Mat mimg = img.clone(); int rows = mimg.rows; int cols = mimg.cols; + int maxValue = *std::max_element(mimg.begin(), mimg.end()); //统计每个灰度出现的次数 - std::vector hisnum(4096, 0);//?????????????????????????????? + std::vector hisnum(maxValue, 0);//?????????????????????????????? for (int i(0); i < rows; ++i) { //std::cout << "i:" << i << std::endl; @@ -27,7 +29,7 @@ std::vector ImageProcessor::CHistogram(const cv::Mat img) //以防数据中有负值:当镜头盖盖上在扣除暗电流就有可能为负值 //如果mat的数据类型为CV_16UC3,当数据中有有负值时,负值表现为65535 - if (gv >= 4096) + if (gv >= maxValue) { ++hisnum[0]; } @@ -35,8 +37,6 @@ std::vector ImageProcessor::CHistogram(const cv::Mat img) { ++hisnum[gv]; } - - } } //开始计算灰度频率