1、 修复部分轮毂只抠一半的bug;2、调整不同权限显示的内容;3、添加界面修改多重曝光的功能

jizhi
QuShuailong 4 years ago
parent d534ed13ee
commit b4cb70a7cf

@ -0,0 +1,10 @@
{
"exposureTime": {
"time1": 500,
"time2": 600,
"time3": 700,
"time4": 800,
"time5": 900
},
"switch": 0
}

@ -251,8 +251,10 @@ cv::Mat ImageProcess::findCircleByBackground(const Mat &srcImg, const Mat& backg
return DetectCircle(srcImg, backgroundImg, center, radius, bEqual, cParam); return DetectCircle(srcImg, backgroundImg, center, radius, bEqual, cParam);
} }
else { else {
center.x = centerX; //center.x = centerX;
center.y = centerY; //center.y = centerY;
center.x = 0;
center.y = 0;
radius = 0; radius = 0;
return DetectCircle(srcImg, backgroundImg, center, radius, bEqual, cParam); return DetectCircle(srcImg, backgroundImg, center, radius, bEqual, cParam);
} }

@ -274,22 +274,36 @@ void QWorkMgrUI::onStateChangedDiameter(int state)
bool QWorkMgrUI::onUserRole() bool QWorkMgrUI::onUserRole()
{ {
int nLevel = m_pCtrl->getUserLevel(); int nLevel = m_pCtrl->getUserLevel();
//9根管理员权限5管理员权限4操作员权限0无权限
if (9 == nLevel) { if (9 == nLevel) {
m_UseDiameter->setVisible(true); m_UseDiameter->setVisible(true);
m_UseThickness->setVisible(true); m_UseThickness->setVisible(true);
m_UseDiameter->setEnabled(true);
m_UseThickness->setEnabled(true);
} }
else if (5 == nLevel) { else if (5 == nLevel) {
m_UseDiameter->setVisible(true); m_UseDiameter->setVisible(true);
m_UseThickness->setVisible(true); m_UseThickness->setVisible(true);
m_UseDiameter->setEnabled(true);
m_UseThickness->setEnabled(true);
} }
else if (4 == nLevel) { else if (4 == nLevel) {
m_UseDiameter->setVisible(false); m_UseDiameter->setVisible(true);
m_UseThickness->setVisible(false); m_UseThickness->setVisible(true);
m_UseDiameter->setEnabled(true);
m_UseThickness->setEnabled(true);
} }
else if (1 == nLevel){ else if (1 == nLevel){
m_UseDiameter->setVisible(false); m_UseDiameter->setVisible(false);
m_UseThickness->setVisible(false); m_UseThickness->setVisible(false);
} }
else if (0 == nLevel)
{
m_UseDiameter->setVisible(true);
m_UseThickness->setVisible(true);
m_UseDiameter->setEnabled(false);
m_UseThickness->setEnabled(false);
}
else { else {
return false; return false;
} }

@ -12,13 +12,24 @@ QAlgParamDlg::QAlgParamDlg(QWidget *parent)
connect(ui.m_pbShowBackImage, SIGNAL(clicked()), this, SLOT(onButtonClicked())); connect(ui.m_pbShowBackImage, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(ui.m_pbApply, SIGNAL(clicked()), this, SLOT(onButtonClicked())); connect(ui.m_pbApply, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(ui.m_pbExit, SIGNAL(clicked()), this, SLOT(onButtonClicked())); connect(ui.m_pbExit, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(ui.m_setExposureTime, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
ui.label->setVisible(false); ui.label->setVisible(false);
m_pExposureTimeDlg = new QExposureTimeDlg();
connect(m_pExposureTimeDlg, SIGNAL(sgExpsParamChange()), this, SLOT(onChangeExps()));
} }
QAlgParamDlg::~QAlgParamDlg() QAlgParamDlg::~QAlgParamDlg()
{ {
if (m_pExposureTimeDlg)
{
delete m_pExposureTimeDlg;
m_pExposureTimeDlg = nullptr;
}
}
Q_SLOT void QAlgParamDlg::onChangeExps()
{
emit sgExpsChange();
} }
Q_SLOT void QAlgParamDlg::onButtonClicked() Q_SLOT void QAlgParamDlg::onButtonClicked()
{ {
QString strObj = sender()->objectName(); QString strObj = sender()->objectName();
@ -35,6 +46,16 @@ Q_SLOT void QAlgParamDlg::onButtonClicked()
m_showImgDlg.setPicPath(DstPath); m_showImgDlg.setPicPath(DstPath);
m_showImgDlg.exec(); m_showImgDlg.exec();
} }
else if (strObj == "m_setExposureTime")
{
if (m_pExposureTimeDlg)
{
m_pExposureTimeDlg->setParent(this);
m_pExposureTimeDlg->setWindowTitle(tr("多重曝光设置"));
m_pExposureTimeDlg->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
m_pExposureTimeDlg->show();
}
}
else if (strObj == "m_pbApply") else if (strObj == "m_pbApply")
{ {
getParam(); getParam();

@ -2,8 +2,11 @@
#define _QALGPARAMDLG_H_ #define _QALGPARAMDLG_H_
#include <QWidget> #include <QWidget>
#include "QExposureTimeDlg.h"
#include "ui_QAlgParamDlg.h" #include "ui_QAlgParamDlg.h"
class QAlgParamDlg : public QWidget class QAlgParamDlg : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -12,19 +15,26 @@ public:
QAlgParamDlg(QWidget *parent = Q_NULLPTR); QAlgParamDlg(QWidget *parent = Q_NULLPTR);
~QAlgParamDlg(); ~QAlgParamDlg();
Q_SLOT void onButtonClicked(); Q_SLOT void onButtonClicked();
signals: signals:
void sgParamChange(); void sgParamChange();
void sgExpsChange();
protected: protected:
Q_SLOT void onChangeBG();
Q_SLOT void onChangeExps();
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent *event);
virtual void timerEvent(QTimerEvent *event); virtual void timerEvent(QTimerEvent *event);
virtual void changeEvent(QEvent *event); virtual void changeEvent(QEvent *event);
void setParam(); void setParam();
void getParam(); void getParam();
Q_SLOT void onChangeBG();
private: private:
Ui::QAlgParamDlg ui; Ui::QAlgParamDlg ui;
int m_timeID{ 0 }; int m_timeID{ 0 };
QExposureTimeDlg* m_pExposureTimeDlg{ nullptr };//算法调参页面
}; };
#endif #endif

@ -6,253 +6,284 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>332</width> <width>340</width>
<height>360</height> <height>553</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>算法参数设置</string> <string>算法参数设置</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_2">
<item row="6" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="title">
<string>型号匹配:</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_ratio">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>是否使用偏距过滤模板</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="title">
<string>二级圆定位:</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox_circle_ACThres">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>边缘宽度:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_circle_EdgeWidth">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox_transform">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<item>
<property name="text">
<string>从深到浅</string>
</property>
</item>
<item>
<property name="text">
<string>从浅到深</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>边缘对比度:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>边缘转换:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_7">
<item row="4" column="0"> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QLabel" name="label_7">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="title"> <property name="text">
<string>二级圆定位:</string> <string>多重曝光设置:</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox_circle_ACThres">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>边缘宽度:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_circle_EdgeWidth">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox_transform">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<item>
<property name="text">
<string>从深到浅</string>
</property>
</item>
<item>
<property name="text">
<string>从浅到深</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>边缘对比度:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>边缘转换:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <widget class="QPushButton" name="m_setExposureTime">
<item> <property name="font">
<widget class="QLabel" name="label_2"> <font>
<property name="font"> <pointsize>12</pointsize>
<font> </font>
<pointsize>12</pointsize> </property>
</font> <property name="text">
</property> <string>设置</string>
<property name="text"> </property>
<string>圆半径大小过滤:</string> </widget>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_filterSize">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>999</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item row="0" column="0"> </layout>
<layout class="QHBoxLayout" name="horizontalLayout_2"> </item>
<item> <item row="1" column="0">
<widget class="QLabel" name="label_4"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="font"> <item>
<font> <widget class="QLabel" name="label_4">
<pointsize>12</pointsize> <property name="font">
</font> <font>
</property> <pointsize>12</pointsize>
<property name="text"> </font>
<string>检测背景图更换:</string> </property>
</property> <property name="text">
</widget> <string>检测背景图更换:</string>
</item> </property>
<item> </widget>
<widget class="QPushButton" name="m_pbShowBackImage">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>查看检测背景</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="2" column="0"> <item>
<widget class="QCheckBox" name="checkBox_equal"> <widget class="QPushButton" name="m_pbShowBackImage">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>是否使用图像增强</string> <string>查看检测背景</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> </layout>
<widget class="QCheckBox" name="checkBox"> </item>
<item row="7" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>参数已生效!!!</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_equal">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>是否使用图像增强</string>
</property>
</widget>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>是否使用背景图找圆算法</string> <string>圆半径大小过滤:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QSpinBox" name="spinBox_filterSize">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="title"> <property name="buttonSymbols">
<string>型号匹配:</string> <enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>999</number>
</property> </property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_ratio">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>是否使用偏距过滤模板</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>是否使用背景图找圆算法</string>
</property>
</widget>
</item>
<item row="8" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
@ -293,13 +324,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>参数已生效!!!</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>

@ -0,0 +1,111 @@
#include "QExposureTimeDlg.h"
#include <QFileDialog>
#pragma execution_character_set("utf-8")
QExposureTimeDlg::QExposureTimeDlg(QWidget* parent) : QWidget(parent)
{
ui.setupUi(this);
ui.appliedLabel->setVisible(false);
connect(ui.m_pbApply, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(ui.m_pbExit, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
}
QExposureTimeDlg::~QExposureTimeDlg()
{
}
Q_SLOT void QExposureTimeDlg::onButtonClicked()
{
QString strObj = sender()->objectName();
if (strObj == "m_pbApply")
{
QString strPath = QApplication::applicationDirPath();
savaParam(strPath);
ui.appliedLabel->setVisible(true);
m_timeID = startTimer(1000);
emit sgExpsParamChange();
}
else if (strObj == "m_pbExit")
{
close();
}
}
void QExposureTimeDlg::showEvent(QShowEvent *event)
{
QString strPath = QApplication::applicationDirPath();
if (!showParam(strPath))
{
}
}
void QExposureTimeDlg::timerEvent(QTimerEvent *event)
{
if (m_timeID == event->timerId())
{
killTimer(m_timeID);
m_timeID = 0;
ui.appliedLabel->setVisible(false);
}
}
bool QExposureTimeDlg::showParam(const QString& strPath)
{
QString filePath = strPath + "\\config\\exposure.json";
QJsonObject jsonObj = QZkJsonParser::ReadJsonAuto(filePath);
if (jsonObj.empty())
{
qDebug() << "Json file parsing failed!";
return false;
}
QJsonObject exposureObj = jsonObj.value("exposureTime").toObject();
QJsonObject::iterator objIterEnd = exposureObj.end();
std::vector<int> exposureTimeVec;
for (auto objIter = exposureObj.begin(); objIter != objIterEnd; objIter++)
{
int exposureTime = objIter.value().toInt();
exposureTimeVec.emplace_back(exposureTime);
}
const unsigned int nSize = exposureTimeVec.size();
if (nSize == 5)
{
ui.exposureTime1->setValue(exposureTimeVec[0]);
ui.exposureTime2->setValue(exposureTimeVec[1]);
ui.exposureTime3->setValue(exposureTimeVec[2]);
ui.exposureTime4->setValue(exposureTimeVec[3]);
ui.exposureTime5->setValue(exposureTimeVec[4]);
}
int switchFlag = jsonObj.value("switch").toInt();
ui.multiExpSwitch->setChecked(switchFlag > 0 ? true : false);
return true;
}
void QExposureTimeDlg::savaParam(const QString& strPath)
{
QString filePath = strPath + "\\config\\exposure.json";
QJsonObject jsonObj;
//QJsonArray jsonArr;
QJsonObject expsObj;
int exposureTime1 = ui.exposureTime1->value();
int exposureTime2 = ui.exposureTime2->value();
int exposureTime3 = ui.exposureTime3->value();
int exposureTime4 = ui.exposureTime4->value();
int exposureTime5 = ui.exposureTime5->value();
expsObj.insert("time1", exposureTime1);
expsObj.insert("time2", exposureTime2);
expsObj.insert("time3", exposureTime3);
expsObj.insert("time4", exposureTime4);
expsObj.insert("time5", exposureTime5);
jsonObj.insert("exposureTime", expsObj);
int switchFlag = ui.multiExpSwitch->isChecked();
jsonObj.insert("switch", switchFlag);
QJsonDocument jsonDoc(jsonObj);
QByteArray data = jsonDoc.toJson();
QFile jsonFile(filePath);
jsonFile.open(QIODevice::WriteOnly);
jsonFile.write(data);
jsonFile.close();
}

@ -0,0 +1,29 @@
#ifndef _H_QEXPOSURETIMEDLG_H_
#define _H_QEXPOSURETIMEDLG_H_
#include "ui_QExposureTimeDlg.h"
#include "QZkJsonParser.h"
#include <QWidget>
#include <QDebug>
class QExposureTimeDlg : public QWidget
{
Q_OBJECT
public:
QExposureTimeDlg(QWidget *parent = Q_NULLPTR);
~QExposureTimeDlg();
Q_SLOT void onButtonClicked();
signals:
void sgExpsParamChange();
protected:
virtual void showEvent(QShowEvent *event);
virtual void timerEvent(QTimerEvent *event);
//virtual void changeEvent(QEvent *event);
private:
Ui::QExposureTimeDlg ui;
bool showParam(const QString& strPath);
void savaParam(const QString& strPath);
int m_timeID{ 0 };
};
#endif // !_H_QEXPOSURETIMEDLG_H_

@ -0,0 +1,276 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QExposureTimeDlg</class>
<widget class="QWidget" name="QExposureTimeDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>292</width>
<height>419</height>
</rect>
</property>
<property name="windowTitle">
<string>曝光值设置</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>曝光值</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>二级曝光值:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="exposureTime2">
<property name="maximum">
<number>100000</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout4">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>四级曝光值:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="exposureTime4">
<property name="maximum">
<number>100000</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="7" column="0">
<layout class="QHBoxLayout" name="horizontalLayoutButton">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_pbApply">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>应用</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_pbExit">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>退出</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout1">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>一级曝光值:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="exposureTime1">
<property name="maximum">
<number>100000</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>三级曝光值:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="exposureTime3">
<property name="maximum">
<number>100000</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout5">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>五级曝光值:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="exposureTime5">
<property name="maximum">
<number>100000</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QLabel" name="appliedLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>参数已修改</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QGroupBox" name="groupbox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="title">
<string>多重曝光开关:</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="multiExpSwitch">
<property name="text">
<string>是否打开多重曝光功能</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -188,6 +188,7 @@ lpMainWin::lpMainWin(QWidget *parent)
m_pAlgParamDlg = new QAlgParamDlg();//算法参数设置页面 m_pAlgParamDlg = new QAlgParamDlg();//算法参数设置页面
connect(m_pAlgParamDlg, SIGNAL(sgParamChange()), this, SLOT(onUpdateUI())); connect(m_pAlgParamDlg, SIGNAL(sgParamChange()), this, SLOT(onUpdateUI()));
connect(m_pAlgParamDlg, SIGNAL(sgExpsChange()), this, SLOT(onUpdateExposureSetting()));
} }
{ {
/*发送模板库线程*/ /*发送模板库线程*/
@ -463,8 +464,9 @@ bool lpMainWin::onInitCoreCtrl()
FuncCallBack_StrImg strImgfunc = std::bind(&lpMainWin::INewCameraImage, this, std::placeholders::_1, std::placeholders::_2); FuncCallBack_StrImg strImgfunc = std::bind(&lpMainWin::INewCameraImage, this, std::placeholders::_1, std::placeholders::_2);
m_pCoreCtrl->IRegisterImageCallBack(strImgfunc); m_pCoreCtrl->IRegisterImageCallBack(strImgfunc);
QStringList s = m_pCoreCtrl->ICameraKeys();
m_camKey = m_pCoreCtrl->ICameraKeys().first(); if(m_pCoreCtrl->ICameraKeys().size()>0)
m_camKey = m_pCoreCtrl->ICameraKeys().first();
return true; return true;
} }
@ -1855,9 +1857,15 @@ Q_SLOT void lpMainWin::onwfPulseTimer()
// frame.data8 = 50; // frame.data8 = 50;
// SendDataToCom(0x43, frame); // SendDataToCom(0x43, frame);
} }
Q_SLOT void lpMainWin::onUpdateExposureSetting()
{
QString strPath = QApplication::applicationDirPath();
readExposureTimeConfig(strPath);
}
bool lpMainWin::readExposureTimeConfig(const QString& strPath) bool lpMainWin::readExposureTimeConfig(const QString& strPath)
{ {
if(!m_exposureTimeArray.empty())
m_exposureTimeArray.clear();
QString filePath = strPath + "\\config\\exposure.json"; QString filePath = strPath + "\\config\\exposure.json";
QJsonObject jsonObj = QZkJsonParser::ReadJsonAuto(filePath); QJsonObject jsonObj = QZkJsonParser::ReadJsonAuto(filePath);
if (jsonObj.empty()) if (jsonObj.empty())

@ -73,7 +73,7 @@ private:
Q_SLOT void onUpdateUI();//修改参数应用时刷新UI显示内容 Q_SLOT void onUpdateUI();//修改参数应用时刷新UI显示内容
Q_SLOT void onShowRatioVal(double val); Q_SLOT void onShowRatioVal(double val);
Q_SLOT void onLineseCheck(bool bFlag); Q_SLOT void onLineseCheck(bool bFlag);
Q_SLOT void onUpdateExposureSetting();
void onStrongButton(); void onStrongButton();
protected: protected:
bool onInitCoreCtrl(); bool onInitCoreCtrl();

Loading…
Cancel
Save