diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/conf/config.ini b/conf/config.ini
new file mode 100644
index 0000000..66e46ad
--- /dev/null
+++ b/conf/config.ini
@@ -0,0 +1,67 @@
+[recognize]
+#最大允许识别时间(ms)
+maxMatchTime=10000
+#识别成功界面停留时间(ms)
+successTipsLast=5000
+#识别失败界面停留时间(ms)
+failureTipsLast=3000
+#人脸识别最大尝试次数
+maxFaceTryCount=20
+#持续没找到人脸的最大次数
+maxFaceNotFoundCount=500
+#注册时最小人脸
+minFaceRegist=240
+#识别时最小人脸
+minFaceRecog=100
+
+#虹膜识别最大尝试次数
+maxIrisTryCount=10
+#虹膜识别持续没有找到眼的最大次数
+maxEyeNotFoundCount=50
+
+#识别方式[1=人脸;2=虹膜;3=双认证;4=任意]
+recogType=4
+
+[window]
+#界面窗口宽(px)
+width=600
+#界面窗口高(px)
+height=1024
+#统一背景色
+backgroundColor="#FFFFFF"
+#标题
+title="虹膜识别终端"
+
+[work]
+#工作状态检测时最小人脸范围
+minFaceSize=160
+#人脸范围最小横坐标
+minFacePosX=320
+#人脸范围最大横坐标
+maxFacePosX=960
+#人脸范围最小纵坐标
+minFacePosY=180
+#人脸范围最大纵坐标
+maxFacePosY=540
+#人脸太近阈值
+faceCloseSize=360
+#人脸太远阈值
+faceFarSize=480
+
+[camera]
+#虹膜相机取一幅画面的时间间隔(ms)
+irisFrameInterval=100
+#虹膜相机拍摄宽度
+irisFrameWidth=1440
+#虹膜相机拍摄高度
+irisFrameHeight=1080
+#虹膜图像高度
+irisWidth=640
+#虹膜图像高度
+irisHeight=480
+
+[log]
+#日志文件位置
+logFile="d://irisLogs//casic_log.txt"
+#日志级别
+logLevel="trace"
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/conf/config.ini b/conf/config.ini
new file mode 100644
index 0000000..66e46ad
--- /dev/null
+++ b/conf/config.ini
@@ -0,0 +1,67 @@
+[recognize]
+#最大允许识别时间(ms)
+maxMatchTime=10000
+#识别成功界面停留时间(ms)
+successTipsLast=5000
+#识别失败界面停留时间(ms)
+failureTipsLast=3000
+#人脸识别最大尝试次数
+maxFaceTryCount=20
+#持续没找到人脸的最大次数
+maxFaceNotFoundCount=500
+#注册时最小人脸
+minFaceRegist=240
+#识别时最小人脸
+minFaceRecog=100
+
+#虹膜识别最大尝试次数
+maxIrisTryCount=10
+#虹膜识别持续没有找到眼的最大次数
+maxEyeNotFoundCount=50
+
+#识别方式[1=人脸;2=虹膜;3=双认证;4=任意]
+recogType=4
+
+[window]
+#界面窗口宽(px)
+width=600
+#界面窗口高(px)
+height=1024
+#统一背景色
+backgroundColor="#FFFFFF"
+#标题
+title="虹膜识别终端"
+
+[work]
+#工作状态检测时最小人脸范围
+minFaceSize=160
+#人脸范围最小横坐标
+minFacePosX=320
+#人脸范围最大横坐标
+maxFacePosX=960
+#人脸范围最小纵坐标
+minFacePosY=180
+#人脸范围最大纵坐标
+maxFacePosY=540
+#人脸太近阈值
+faceCloseSize=360
+#人脸太远阈值
+faceFarSize=480
+
+[camera]
+#虹膜相机取一幅画面的时间间隔(ms)
+irisFrameInterval=100
+#虹膜相机拍摄宽度
+irisFrameWidth=1440
+#虹膜相机拍摄高度
+irisFrameHeight=1080
+#虹膜图像高度
+irisWidth=640
+#虹膜图像高度
+irisHeight=480
+
+[log]
+#日志文件位置
+logFile="d://irisLogs//casic_log.txt"
+#日志级别
+logLevel="trace"
diff --git a/dao/BaseDao.cpp b/dao/BaseDao.cpp
new file mode 100644
index 0000000..f51c144
--- /dev/null
+++ b/dao/BaseDao.cpp
@@ -0,0 +1,12 @@
+#include "BaseDao.h"
+#include "dao/util/ConnectionManager.h"
+
+BaseDao::BaseDao(QObject *parent) : QObject(parent)
+{
+
+}
+
+BaseDao::~BaseDao()
+{
+
+}
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/conf/config.ini b/conf/config.ini
new file mode 100644
index 0000000..66e46ad
--- /dev/null
+++ b/conf/config.ini
@@ -0,0 +1,67 @@
+[recognize]
+#最大允许识别时间(ms)
+maxMatchTime=10000
+#识别成功界面停留时间(ms)
+successTipsLast=5000
+#识别失败界面停留时间(ms)
+failureTipsLast=3000
+#人脸识别最大尝试次数
+maxFaceTryCount=20
+#持续没找到人脸的最大次数
+maxFaceNotFoundCount=500
+#注册时最小人脸
+minFaceRegist=240
+#识别时最小人脸
+minFaceRecog=100
+
+#虹膜识别最大尝试次数
+maxIrisTryCount=10
+#虹膜识别持续没有找到眼的最大次数
+maxEyeNotFoundCount=50
+
+#识别方式[1=人脸;2=虹膜;3=双认证;4=任意]
+recogType=4
+
+[window]
+#界面窗口宽(px)
+width=600
+#界面窗口高(px)
+height=1024
+#统一背景色
+backgroundColor="#FFFFFF"
+#标题
+title="虹膜识别终端"
+
+[work]
+#工作状态检测时最小人脸范围
+minFaceSize=160
+#人脸范围最小横坐标
+minFacePosX=320
+#人脸范围最大横坐标
+maxFacePosX=960
+#人脸范围最小纵坐标
+minFacePosY=180
+#人脸范围最大纵坐标
+maxFacePosY=540
+#人脸太近阈值
+faceCloseSize=360
+#人脸太远阈值
+faceFarSize=480
+
+[camera]
+#虹膜相机取一幅画面的时间间隔(ms)
+irisFrameInterval=100
+#虹膜相机拍摄宽度
+irisFrameWidth=1440
+#虹膜相机拍摄高度
+irisFrameHeight=1080
+#虹膜图像高度
+irisWidth=640
+#虹膜图像高度
+irisHeight=480
+
+[log]
+#日志文件位置
+logFile="d://irisLogs//casic_log.txt"
+#日志级别
+logLevel="trace"
diff --git a/dao/BaseDao.cpp b/dao/BaseDao.cpp
new file mode 100644
index 0000000..f51c144
--- /dev/null
+++ b/dao/BaseDao.cpp
@@ -0,0 +1,12 @@
+#include "BaseDao.h"
+#include "dao/util/ConnectionManager.h"
+
+BaseDao::BaseDao(QObject *parent) : QObject(parent)
+{
+
+}
+
+BaseDao::~BaseDao()
+{
+
+}
diff --git a/dao/BaseDao.h b/dao/BaseDao.h
new file mode 100644
index 0000000..1693c88
--- /dev/null
+++ b/dao/BaseDao.h
@@ -0,0 +1,32 @@
+#ifndef BASEDAO_H
+#define BASEDAO_H
+
+#include
+#include
+#include
+#include
+
+#include "dao/util/ConnectionManager.h"
+#include "utils/UtilInclude.h"
+
+class BaseDao : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BaseDao(QObject *parent = nullptr);
+ ~BaseDao();
+
+ virtual QVector findAllRecord() = 0;
+ virtual QVariantMap findRecordById(QString id) = 0;
+
+ virtual QString save(QVariantMap object) = 0;
+ virtual bool edit(QVariantMap newObject, QString id) = 0;
+ virtual bool dele(QString id) = 0;
+
+private:
+
+signals:
+
+};
+
+#endif // BASEDAO_H
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/conf/config.ini b/conf/config.ini
new file mode 100644
index 0000000..66e46ad
--- /dev/null
+++ b/conf/config.ini
@@ -0,0 +1,67 @@
+[recognize]
+#最大允许识别时间(ms)
+maxMatchTime=10000
+#识别成功界面停留时间(ms)
+successTipsLast=5000
+#识别失败界面停留时间(ms)
+failureTipsLast=3000
+#人脸识别最大尝试次数
+maxFaceTryCount=20
+#持续没找到人脸的最大次数
+maxFaceNotFoundCount=500
+#注册时最小人脸
+minFaceRegist=240
+#识别时最小人脸
+minFaceRecog=100
+
+#虹膜识别最大尝试次数
+maxIrisTryCount=10
+#虹膜识别持续没有找到眼的最大次数
+maxEyeNotFoundCount=50
+
+#识别方式[1=人脸;2=虹膜;3=双认证;4=任意]
+recogType=4
+
+[window]
+#界面窗口宽(px)
+width=600
+#界面窗口高(px)
+height=1024
+#统一背景色
+backgroundColor="#FFFFFF"
+#标题
+title="虹膜识别终端"
+
+[work]
+#工作状态检测时最小人脸范围
+minFaceSize=160
+#人脸范围最小横坐标
+minFacePosX=320
+#人脸范围最大横坐标
+maxFacePosX=960
+#人脸范围最小纵坐标
+minFacePosY=180
+#人脸范围最大纵坐标
+maxFacePosY=540
+#人脸太近阈值
+faceCloseSize=360
+#人脸太远阈值
+faceFarSize=480
+
+[camera]
+#虹膜相机取一幅画面的时间间隔(ms)
+irisFrameInterval=100
+#虹膜相机拍摄宽度
+irisFrameWidth=1440
+#虹膜相机拍摄高度
+irisFrameHeight=1080
+#虹膜图像高度
+irisWidth=640
+#虹膜图像高度
+irisHeight=480
+
+[log]
+#日志文件位置
+logFile="d://irisLogs//casic_log.txt"
+#日志级别
+logLevel="trace"
diff --git a/dao/BaseDao.cpp b/dao/BaseDao.cpp
new file mode 100644
index 0000000..f51c144
--- /dev/null
+++ b/dao/BaseDao.cpp
@@ -0,0 +1,12 @@
+#include "BaseDao.h"
+#include "dao/util/ConnectionManager.h"
+
+BaseDao::BaseDao(QObject *parent) : QObject(parent)
+{
+
+}
+
+BaseDao::~BaseDao()
+{
+
+}
diff --git a/dao/BaseDao.h b/dao/BaseDao.h
new file mode 100644
index 0000000..1693c88
--- /dev/null
+++ b/dao/BaseDao.h
@@ -0,0 +1,32 @@
+#ifndef BASEDAO_H
+#define BASEDAO_H
+
+#include
+#include
+#include
+#include
+
+#include "dao/util/ConnectionManager.h"
+#include "utils/UtilInclude.h"
+
+class BaseDao : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BaseDao(QObject *parent = nullptr);
+ ~BaseDao();
+
+ virtual QVector findAllRecord() = 0;
+ virtual QVariantMap findRecordById(QString id) = 0;
+
+ virtual QString save(QVariantMap object) = 0;
+ virtual bool edit(QVariantMap newObject, QString id) = 0;
+ virtual bool dele(QString id) = 0;
+
+private:
+
+signals:
+
+};
+
+#endif // BASEDAO_H
diff --git a/dao/IrisDataDao.cpp b/dao/IrisDataDao.cpp
new file mode 100644
index 0000000..37a0ed6
--- /dev/null
+++ b/dao/IrisDataDao.cpp
@@ -0,0 +1,204 @@
+#include "IrisDataDao.h"
+
+IrisDataDao::IrisDataDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+QVector IrisDataDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM IRIS_DATA";
+ query.prepare(sql);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+
+ item.insert("id", query.value("id").toString());
+ item.insert("person_id", query.value("person_id").toString());
+ item.insert("id_card_no", query.value("id_card_no").toString());
+ item.insert("left_iris_code1", query.value("left_iris_code1"));
+ item.insert("left_iris_code2", query.value("left_iris_code2"));
+ item.insert("left_iris_code3", query.value("left_iris_code3"));
+ item.insert("right_iris_code1", query.value("right_iris_code1"));
+ item.insert("right_iris_code2", query.value("right_iris_code2"));
+ item.insert("right_iris_code3", query.value("right_iris_code3"));
+
+ result.append(item);
+ }
+
+// LOG_DEBUG(QString("查询IRIS_DATA表的所有记录[结果数:%1]").arg(result.size()).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordById(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ // 获取结果
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据id查询IRIS_DATA表的记录[id=%1]").arg(id).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordByPersonId(QString personId)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE PERSON_ID = :personId");
+ query.prepare(sql);
+ query.bindValue(":personId", personId);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据personId查询IRIS_DATA表的记录[personId=%1]").arg(personId).toStdString());
+ return result;
+}
+
+
+QString IrisDataDao::save(QVariantMap object)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ qulonglong id = ConnectionManager::getInstance()->generateId();
+
+ // INSERT语句
+ QString sql = QString("INSERT INTO IRIS_DATA (ID, PERSON_ID, ID_CARD_NO, LEFT_IRIS_CODE1, RIGHT_IRIS_CODE1) VALUES (:id, :personId, :idCardNo, :left1, :right1)");
+
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":personId", object.value("person_id").toString());
+ query.bindValue(":idCardNo", object.value("id_card_no").toString());
+ query.bindValue(":left1", object.value("left_iris_code1"));
+ query.bindValue(":right1", object.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行插入
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("保存虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ if (success == true)
+ {
+ return QString("%1").arg(id);
+ }
+ else
+ {
+ return "-1";
+ }
+}
+
+bool IrisDataDao::edit(QVariantMap newObject, QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // UPDATE语句
+ if (!newObject.contains("left_iris_code1") || !newObject.contains("right_iris_code1")){
+ return false;
+ }
+ QString sql = QString("UPDATE IRIS_DATA SET LEFT_IRIS_CODE1 = :left1, RIGHT_IRIS_CODE1 = :right1 WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":left1", newObject.value("left_iris_code1"));
+ query.bindValue(":right1", newObject.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("编辑虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
+
+
+bool IrisDataDao::dele(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ QString sql = QString("DELETE FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("删除虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/conf/config.ini b/conf/config.ini
new file mode 100644
index 0000000..66e46ad
--- /dev/null
+++ b/conf/config.ini
@@ -0,0 +1,67 @@
+[recognize]
+#最大允许识别时间(ms)
+maxMatchTime=10000
+#识别成功界面停留时间(ms)
+successTipsLast=5000
+#识别失败界面停留时间(ms)
+failureTipsLast=3000
+#人脸识别最大尝试次数
+maxFaceTryCount=20
+#持续没找到人脸的最大次数
+maxFaceNotFoundCount=500
+#注册时最小人脸
+minFaceRegist=240
+#识别时最小人脸
+minFaceRecog=100
+
+#虹膜识别最大尝试次数
+maxIrisTryCount=10
+#虹膜识别持续没有找到眼的最大次数
+maxEyeNotFoundCount=50
+
+#识别方式[1=人脸;2=虹膜;3=双认证;4=任意]
+recogType=4
+
+[window]
+#界面窗口宽(px)
+width=600
+#界面窗口高(px)
+height=1024
+#统一背景色
+backgroundColor="#FFFFFF"
+#标题
+title="虹膜识别终端"
+
+[work]
+#工作状态检测时最小人脸范围
+minFaceSize=160
+#人脸范围最小横坐标
+minFacePosX=320
+#人脸范围最大横坐标
+maxFacePosX=960
+#人脸范围最小纵坐标
+minFacePosY=180
+#人脸范围最大纵坐标
+maxFacePosY=540
+#人脸太近阈值
+faceCloseSize=360
+#人脸太远阈值
+faceFarSize=480
+
+[camera]
+#虹膜相机取一幅画面的时间间隔(ms)
+irisFrameInterval=100
+#虹膜相机拍摄宽度
+irisFrameWidth=1440
+#虹膜相机拍摄高度
+irisFrameHeight=1080
+#虹膜图像高度
+irisWidth=640
+#虹膜图像高度
+irisHeight=480
+
+[log]
+#日志文件位置
+logFile="d://irisLogs//casic_log.txt"
+#日志级别
+logLevel="trace"
diff --git a/dao/BaseDao.cpp b/dao/BaseDao.cpp
new file mode 100644
index 0000000..f51c144
--- /dev/null
+++ b/dao/BaseDao.cpp
@@ -0,0 +1,12 @@
+#include "BaseDao.h"
+#include "dao/util/ConnectionManager.h"
+
+BaseDao::BaseDao(QObject *parent) : QObject(parent)
+{
+
+}
+
+BaseDao::~BaseDao()
+{
+
+}
diff --git a/dao/BaseDao.h b/dao/BaseDao.h
new file mode 100644
index 0000000..1693c88
--- /dev/null
+++ b/dao/BaseDao.h
@@ -0,0 +1,32 @@
+#ifndef BASEDAO_H
+#define BASEDAO_H
+
+#include
+#include
+#include
+#include
+
+#include "dao/util/ConnectionManager.h"
+#include "utils/UtilInclude.h"
+
+class BaseDao : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BaseDao(QObject *parent = nullptr);
+ ~BaseDao();
+
+ virtual QVector findAllRecord() = 0;
+ virtual QVariantMap findRecordById(QString id) = 0;
+
+ virtual QString save(QVariantMap object) = 0;
+ virtual bool edit(QVariantMap newObject, QString id) = 0;
+ virtual bool dele(QString id) = 0;
+
+private:
+
+signals:
+
+};
+
+#endif // BASEDAO_H
diff --git a/dao/IrisDataDao.cpp b/dao/IrisDataDao.cpp
new file mode 100644
index 0000000..37a0ed6
--- /dev/null
+++ b/dao/IrisDataDao.cpp
@@ -0,0 +1,204 @@
+#include "IrisDataDao.h"
+
+IrisDataDao::IrisDataDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+QVector IrisDataDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM IRIS_DATA";
+ query.prepare(sql);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+
+ item.insert("id", query.value("id").toString());
+ item.insert("person_id", query.value("person_id").toString());
+ item.insert("id_card_no", query.value("id_card_no").toString());
+ item.insert("left_iris_code1", query.value("left_iris_code1"));
+ item.insert("left_iris_code2", query.value("left_iris_code2"));
+ item.insert("left_iris_code3", query.value("left_iris_code3"));
+ item.insert("right_iris_code1", query.value("right_iris_code1"));
+ item.insert("right_iris_code2", query.value("right_iris_code2"));
+ item.insert("right_iris_code3", query.value("right_iris_code3"));
+
+ result.append(item);
+ }
+
+// LOG_DEBUG(QString("查询IRIS_DATA表的所有记录[结果数:%1]").arg(result.size()).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordById(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ // 获取结果
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据id查询IRIS_DATA表的记录[id=%1]").arg(id).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordByPersonId(QString personId)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE PERSON_ID = :personId");
+ query.prepare(sql);
+ query.bindValue(":personId", personId);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据personId查询IRIS_DATA表的记录[personId=%1]").arg(personId).toStdString());
+ return result;
+}
+
+
+QString IrisDataDao::save(QVariantMap object)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ qulonglong id = ConnectionManager::getInstance()->generateId();
+
+ // INSERT语句
+ QString sql = QString("INSERT INTO IRIS_DATA (ID, PERSON_ID, ID_CARD_NO, LEFT_IRIS_CODE1, RIGHT_IRIS_CODE1) VALUES (:id, :personId, :idCardNo, :left1, :right1)");
+
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":personId", object.value("person_id").toString());
+ query.bindValue(":idCardNo", object.value("id_card_no").toString());
+ query.bindValue(":left1", object.value("left_iris_code1"));
+ query.bindValue(":right1", object.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行插入
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("保存虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ if (success == true)
+ {
+ return QString("%1").arg(id);
+ }
+ else
+ {
+ return "-1";
+ }
+}
+
+bool IrisDataDao::edit(QVariantMap newObject, QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // UPDATE语句
+ if (!newObject.contains("left_iris_code1") || !newObject.contains("right_iris_code1")){
+ return false;
+ }
+ QString sql = QString("UPDATE IRIS_DATA SET LEFT_IRIS_CODE1 = :left1, RIGHT_IRIS_CODE1 = :right1 WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":left1", newObject.value("left_iris_code1"));
+ query.bindValue(":right1", newObject.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("编辑虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
+
+
+bool IrisDataDao::dele(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ QString sql = QString("DELETE FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("删除虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
diff --git a/dao/IrisDataDao.h b/dao/IrisDataDao.h
new file mode 100644
index 0000000..c74dbbd
--- /dev/null
+++ b/dao/IrisDataDao.h
@@ -0,0 +1,25 @@
+#ifndef IRISDATADAO_H
+#define IRISDATADAO_H
+
+#include
+#include "BaseDao.h"
+
+class IrisDataDao : public BaseDao
+{
+ Q_OBJECT
+public:
+ explicit IrisDataDao(QObject *parent = nullptr);
+
+ QVector findAllRecord();
+ QVariantMap findRecordById(QString id);
+ QVariantMap findRecordByPersonId(QString personId);
+
+ QString save(QVariantMap object);
+ bool edit(QVariantMap newObject, QString id);
+ bool dele(QString id);
+
+signals:
+
+};
+
+#endif // IRISDATADAO_H
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/conf/config.ini b/conf/config.ini
new file mode 100644
index 0000000..66e46ad
--- /dev/null
+++ b/conf/config.ini
@@ -0,0 +1,67 @@
+[recognize]
+#最大允许识别时间(ms)
+maxMatchTime=10000
+#识别成功界面停留时间(ms)
+successTipsLast=5000
+#识别失败界面停留时间(ms)
+failureTipsLast=3000
+#人脸识别最大尝试次数
+maxFaceTryCount=20
+#持续没找到人脸的最大次数
+maxFaceNotFoundCount=500
+#注册时最小人脸
+minFaceRegist=240
+#识别时最小人脸
+minFaceRecog=100
+
+#虹膜识别最大尝试次数
+maxIrisTryCount=10
+#虹膜识别持续没有找到眼的最大次数
+maxEyeNotFoundCount=50
+
+#识别方式[1=人脸;2=虹膜;3=双认证;4=任意]
+recogType=4
+
+[window]
+#界面窗口宽(px)
+width=600
+#界面窗口高(px)
+height=1024
+#统一背景色
+backgroundColor="#FFFFFF"
+#标题
+title="虹膜识别终端"
+
+[work]
+#工作状态检测时最小人脸范围
+minFaceSize=160
+#人脸范围最小横坐标
+minFacePosX=320
+#人脸范围最大横坐标
+maxFacePosX=960
+#人脸范围最小纵坐标
+minFacePosY=180
+#人脸范围最大纵坐标
+maxFacePosY=540
+#人脸太近阈值
+faceCloseSize=360
+#人脸太远阈值
+faceFarSize=480
+
+[camera]
+#虹膜相机取一幅画面的时间间隔(ms)
+irisFrameInterval=100
+#虹膜相机拍摄宽度
+irisFrameWidth=1440
+#虹膜相机拍摄高度
+irisFrameHeight=1080
+#虹膜图像高度
+irisWidth=640
+#虹膜图像高度
+irisHeight=480
+
+[log]
+#日志文件位置
+logFile="d://irisLogs//casic_log.txt"
+#日志级别
+logLevel="trace"
diff --git a/dao/BaseDao.cpp b/dao/BaseDao.cpp
new file mode 100644
index 0000000..f51c144
--- /dev/null
+++ b/dao/BaseDao.cpp
@@ -0,0 +1,12 @@
+#include "BaseDao.h"
+#include "dao/util/ConnectionManager.h"
+
+BaseDao::BaseDao(QObject *parent) : QObject(parent)
+{
+
+}
+
+BaseDao::~BaseDao()
+{
+
+}
diff --git a/dao/BaseDao.h b/dao/BaseDao.h
new file mode 100644
index 0000000..1693c88
--- /dev/null
+++ b/dao/BaseDao.h
@@ -0,0 +1,32 @@
+#ifndef BASEDAO_H
+#define BASEDAO_H
+
+#include
+#include
+#include
+#include
+
+#include "dao/util/ConnectionManager.h"
+#include "utils/UtilInclude.h"
+
+class BaseDao : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BaseDao(QObject *parent = nullptr);
+ ~BaseDao();
+
+ virtual QVector findAllRecord() = 0;
+ virtual QVariantMap findRecordById(QString id) = 0;
+
+ virtual QString save(QVariantMap object) = 0;
+ virtual bool edit(QVariantMap newObject, QString id) = 0;
+ virtual bool dele(QString id) = 0;
+
+private:
+
+signals:
+
+};
+
+#endif // BASEDAO_H
diff --git a/dao/IrisDataDao.cpp b/dao/IrisDataDao.cpp
new file mode 100644
index 0000000..37a0ed6
--- /dev/null
+++ b/dao/IrisDataDao.cpp
@@ -0,0 +1,204 @@
+#include "IrisDataDao.h"
+
+IrisDataDao::IrisDataDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+QVector IrisDataDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM IRIS_DATA";
+ query.prepare(sql);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+
+ item.insert("id", query.value("id").toString());
+ item.insert("person_id", query.value("person_id").toString());
+ item.insert("id_card_no", query.value("id_card_no").toString());
+ item.insert("left_iris_code1", query.value("left_iris_code1"));
+ item.insert("left_iris_code2", query.value("left_iris_code2"));
+ item.insert("left_iris_code3", query.value("left_iris_code3"));
+ item.insert("right_iris_code1", query.value("right_iris_code1"));
+ item.insert("right_iris_code2", query.value("right_iris_code2"));
+ item.insert("right_iris_code3", query.value("right_iris_code3"));
+
+ result.append(item);
+ }
+
+// LOG_DEBUG(QString("查询IRIS_DATA表的所有记录[结果数:%1]").arg(result.size()).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordById(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ // 获取结果
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据id查询IRIS_DATA表的记录[id=%1]").arg(id).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordByPersonId(QString personId)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE PERSON_ID = :personId");
+ query.prepare(sql);
+ query.bindValue(":personId", personId);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据personId查询IRIS_DATA表的记录[personId=%1]").arg(personId).toStdString());
+ return result;
+}
+
+
+QString IrisDataDao::save(QVariantMap object)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ qulonglong id = ConnectionManager::getInstance()->generateId();
+
+ // INSERT语句
+ QString sql = QString("INSERT INTO IRIS_DATA (ID, PERSON_ID, ID_CARD_NO, LEFT_IRIS_CODE1, RIGHT_IRIS_CODE1) VALUES (:id, :personId, :idCardNo, :left1, :right1)");
+
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":personId", object.value("person_id").toString());
+ query.bindValue(":idCardNo", object.value("id_card_no").toString());
+ query.bindValue(":left1", object.value("left_iris_code1"));
+ query.bindValue(":right1", object.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行插入
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("保存虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ if (success == true)
+ {
+ return QString("%1").arg(id);
+ }
+ else
+ {
+ return "-1";
+ }
+}
+
+bool IrisDataDao::edit(QVariantMap newObject, QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // UPDATE语句
+ if (!newObject.contains("left_iris_code1") || !newObject.contains("right_iris_code1")){
+ return false;
+ }
+ QString sql = QString("UPDATE IRIS_DATA SET LEFT_IRIS_CODE1 = :left1, RIGHT_IRIS_CODE1 = :right1 WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":left1", newObject.value("left_iris_code1"));
+ query.bindValue(":right1", newObject.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("编辑虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
+
+
+bool IrisDataDao::dele(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ QString sql = QString("DELETE FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("删除虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
diff --git a/dao/IrisDataDao.h b/dao/IrisDataDao.h
new file mode 100644
index 0000000..c74dbbd
--- /dev/null
+++ b/dao/IrisDataDao.h
@@ -0,0 +1,25 @@
+#ifndef IRISDATADAO_H
+#define IRISDATADAO_H
+
+#include
+#include "BaseDao.h"
+
+class IrisDataDao : public BaseDao
+{
+ Q_OBJECT
+public:
+ explicit IrisDataDao(QObject *parent = nullptr);
+
+ QVector findAllRecord();
+ QVariantMap findRecordById(QString id);
+ QVariantMap findRecordByPersonId(QString personId);
+
+ QString save(QVariantMap object);
+ bool edit(QVariantMap newObject, QString id);
+ bool dele(QString id);
+
+signals:
+
+};
+
+#endif // IRISDATADAO_H
diff --git a/dao/RecognitionRecordsDao.cpp b/dao/RecognitionRecordsDao.cpp
new file mode 100644
index 0000000..40db453
--- /dev/null
+++ b/dao/RecognitionRecordsDao.cpp
@@ -0,0 +1,100 @@
+#include "RecognitionRecordsDao.h"
+
+RecognitionRecordsDao::RecognitionRecordsDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+
+QVector RecognitionRecordsDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM RECOGNITION_RECORDS";
+
+ // 执行查询
+ query.exec(sql);
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+
+ item.insert("id", query.value("id").toLongLong());
+ result.append(item);
+ }
+
+// LOG_DEBUG(QString("查询RECOGNITION_RECORDS表的所有记录[记录数:%1]").arg(result.size()).toStdString());
+ return result;
+}
+
+QVariantMap RecognitionRecordsDao::findRecordById(QString id)
+{
+ QVariantMap item;
+ return item;
+}
+
+QString RecognitionRecordsDao::save(QVariantMap object)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ qulonglong id = ConnectionManager::getInstance()->generateId();
+
+ // INSERT语句
+ QString sql = QString("INSERT INTO RECOGNITION_RECORDS (ID, PERSON_ID, DATETIME, REC_TYPE, DEV_CODE, DOOR_CODE, INOUT_TYPE) "
+ "VALUES (:id, :personId, :datetime, :recType, :devCode, :doorCode, :inoutType)");
+
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":personId", object.value("person_id").toString());
+ query.bindValue(":datetime", object.value("date_time").toString());
+ query.bindValue(":recType", object.value("rec_type").toString());
+ query.bindValue(":devCode", object.value("dev_code").toString());
+ query.bindValue(":doorCode", object.value("door_code").toString());
+ query.bindValue(":inoutType", object.value("inout_type").toString());
+
+// LOG_DEBUG(sql.toStdString());
+
+ // 插入识别的log日志
+ QString logStr = QString("INSERT INTO RECOGNITION_LOGS (ID, LOG_INFO) VALUES (:id, :logInfo)");
+
+ QSqlQuery logQuery(ConnectionManager::getInstance()->getConnection());
+ logQuery.prepare(logStr);
+ logQuery.bindValue(":id", id);
+ logQuery.bindValue(":logInfo", object.value("debug_info").toString());
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行插入
+ bool success = query.exec();
+ logQuery.exec();
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ if (success == true)
+ {
+ return QString("%1").arg(id);
+ }
+ else
+ {
+ return "-1";
+ }
+}
+
+bool RecognitionRecordsDao::edit(QVariantMap newObject, QString id)
+{
+ return false;
+}
+
+bool RecognitionRecordsDao::dele(QString id)
+{
+ return false;
+}
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/conf/config.ini b/conf/config.ini
new file mode 100644
index 0000000..66e46ad
--- /dev/null
+++ b/conf/config.ini
@@ -0,0 +1,67 @@
+[recognize]
+#最大允许识别时间(ms)
+maxMatchTime=10000
+#识别成功界面停留时间(ms)
+successTipsLast=5000
+#识别失败界面停留时间(ms)
+failureTipsLast=3000
+#人脸识别最大尝试次数
+maxFaceTryCount=20
+#持续没找到人脸的最大次数
+maxFaceNotFoundCount=500
+#注册时最小人脸
+minFaceRegist=240
+#识别时最小人脸
+minFaceRecog=100
+
+#虹膜识别最大尝试次数
+maxIrisTryCount=10
+#虹膜识别持续没有找到眼的最大次数
+maxEyeNotFoundCount=50
+
+#识别方式[1=人脸;2=虹膜;3=双认证;4=任意]
+recogType=4
+
+[window]
+#界面窗口宽(px)
+width=600
+#界面窗口高(px)
+height=1024
+#统一背景色
+backgroundColor="#FFFFFF"
+#标题
+title="虹膜识别终端"
+
+[work]
+#工作状态检测时最小人脸范围
+minFaceSize=160
+#人脸范围最小横坐标
+minFacePosX=320
+#人脸范围最大横坐标
+maxFacePosX=960
+#人脸范围最小纵坐标
+minFacePosY=180
+#人脸范围最大纵坐标
+maxFacePosY=540
+#人脸太近阈值
+faceCloseSize=360
+#人脸太远阈值
+faceFarSize=480
+
+[camera]
+#虹膜相机取一幅画面的时间间隔(ms)
+irisFrameInterval=100
+#虹膜相机拍摄宽度
+irisFrameWidth=1440
+#虹膜相机拍摄高度
+irisFrameHeight=1080
+#虹膜图像高度
+irisWidth=640
+#虹膜图像高度
+irisHeight=480
+
+[log]
+#日志文件位置
+logFile="d://irisLogs//casic_log.txt"
+#日志级别
+logLevel="trace"
diff --git a/dao/BaseDao.cpp b/dao/BaseDao.cpp
new file mode 100644
index 0000000..f51c144
--- /dev/null
+++ b/dao/BaseDao.cpp
@@ -0,0 +1,12 @@
+#include "BaseDao.h"
+#include "dao/util/ConnectionManager.h"
+
+BaseDao::BaseDao(QObject *parent) : QObject(parent)
+{
+
+}
+
+BaseDao::~BaseDao()
+{
+
+}
diff --git a/dao/BaseDao.h b/dao/BaseDao.h
new file mode 100644
index 0000000..1693c88
--- /dev/null
+++ b/dao/BaseDao.h
@@ -0,0 +1,32 @@
+#ifndef BASEDAO_H
+#define BASEDAO_H
+
+#include
+#include
+#include
+#include
+
+#include "dao/util/ConnectionManager.h"
+#include "utils/UtilInclude.h"
+
+class BaseDao : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BaseDao(QObject *parent = nullptr);
+ ~BaseDao();
+
+ virtual QVector findAllRecord() = 0;
+ virtual QVariantMap findRecordById(QString id) = 0;
+
+ virtual QString save(QVariantMap object) = 0;
+ virtual bool edit(QVariantMap newObject, QString id) = 0;
+ virtual bool dele(QString id) = 0;
+
+private:
+
+signals:
+
+};
+
+#endif // BASEDAO_H
diff --git a/dao/IrisDataDao.cpp b/dao/IrisDataDao.cpp
new file mode 100644
index 0000000..37a0ed6
--- /dev/null
+++ b/dao/IrisDataDao.cpp
@@ -0,0 +1,204 @@
+#include "IrisDataDao.h"
+
+IrisDataDao::IrisDataDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+QVector IrisDataDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM IRIS_DATA";
+ query.prepare(sql);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+
+ item.insert("id", query.value("id").toString());
+ item.insert("person_id", query.value("person_id").toString());
+ item.insert("id_card_no", query.value("id_card_no").toString());
+ item.insert("left_iris_code1", query.value("left_iris_code1"));
+ item.insert("left_iris_code2", query.value("left_iris_code2"));
+ item.insert("left_iris_code3", query.value("left_iris_code3"));
+ item.insert("right_iris_code1", query.value("right_iris_code1"));
+ item.insert("right_iris_code2", query.value("right_iris_code2"));
+ item.insert("right_iris_code3", query.value("right_iris_code3"));
+
+ result.append(item);
+ }
+
+// LOG_DEBUG(QString("查询IRIS_DATA表的所有记录[结果数:%1]").arg(result.size()).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordById(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ // 获取结果
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据id查询IRIS_DATA表的记录[id=%1]").arg(id).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordByPersonId(QString personId)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE PERSON_ID = :personId");
+ query.prepare(sql);
+ query.bindValue(":personId", personId);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据personId查询IRIS_DATA表的记录[personId=%1]").arg(personId).toStdString());
+ return result;
+}
+
+
+QString IrisDataDao::save(QVariantMap object)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ qulonglong id = ConnectionManager::getInstance()->generateId();
+
+ // INSERT语句
+ QString sql = QString("INSERT INTO IRIS_DATA (ID, PERSON_ID, ID_CARD_NO, LEFT_IRIS_CODE1, RIGHT_IRIS_CODE1) VALUES (:id, :personId, :idCardNo, :left1, :right1)");
+
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":personId", object.value("person_id").toString());
+ query.bindValue(":idCardNo", object.value("id_card_no").toString());
+ query.bindValue(":left1", object.value("left_iris_code1"));
+ query.bindValue(":right1", object.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行插入
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("保存虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ if (success == true)
+ {
+ return QString("%1").arg(id);
+ }
+ else
+ {
+ return "-1";
+ }
+}
+
+bool IrisDataDao::edit(QVariantMap newObject, QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // UPDATE语句
+ if (!newObject.contains("left_iris_code1") || !newObject.contains("right_iris_code1")){
+ return false;
+ }
+ QString sql = QString("UPDATE IRIS_DATA SET LEFT_IRIS_CODE1 = :left1, RIGHT_IRIS_CODE1 = :right1 WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":left1", newObject.value("left_iris_code1"));
+ query.bindValue(":right1", newObject.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("编辑虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
+
+
+bool IrisDataDao::dele(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ QString sql = QString("DELETE FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("删除虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
diff --git a/dao/IrisDataDao.h b/dao/IrisDataDao.h
new file mode 100644
index 0000000..c74dbbd
--- /dev/null
+++ b/dao/IrisDataDao.h
@@ -0,0 +1,25 @@
+#ifndef IRISDATADAO_H
+#define IRISDATADAO_H
+
+#include
+#include "BaseDao.h"
+
+class IrisDataDao : public BaseDao
+{
+ Q_OBJECT
+public:
+ explicit IrisDataDao(QObject *parent = nullptr);
+
+ QVector findAllRecord();
+ QVariantMap findRecordById(QString id);
+ QVariantMap findRecordByPersonId(QString personId);
+
+ QString save(QVariantMap object);
+ bool edit(QVariantMap newObject, QString id);
+ bool dele(QString id);
+
+signals:
+
+};
+
+#endif // IRISDATADAO_H
diff --git a/dao/RecognitionRecordsDao.cpp b/dao/RecognitionRecordsDao.cpp
new file mode 100644
index 0000000..40db453
--- /dev/null
+++ b/dao/RecognitionRecordsDao.cpp
@@ -0,0 +1,100 @@
+#include "RecognitionRecordsDao.h"
+
+RecognitionRecordsDao::RecognitionRecordsDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+
+QVector RecognitionRecordsDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM RECOGNITION_RECORDS";
+
+ // 执行查询
+ query.exec(sql);
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+
+ item.insert("id", query.value("id").toLongLong());
+ result.append(item);
+ }
+
+// LOG_DEBUG(QString("查询RECOGNITION_RECORDS表的所有记录[记录数:%1]").arg(result.size()).toStdString());
+ return result;
+}
+
+QVariantMap RecognitionRecordsDao::findRecordById(QString id)
+{
+ QVariantMap item;
+ return item;
+}
+
+QString RecognitionRecordsDao::save(QVariantMap object)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ qulonglong id = ConnectionManager::getInstance()->generateId();
+
+ // INSERT语句
+ QString sql = QString("INSERT INTO RECOGNITION_RECORDS (ID, PERSON_ID, DATETIME, REC_TYPE, DEV_CODE, DOOR_CODE, INOUT_TYPE) "
+ "VALUES (:id, :personId, :datetime, :recType, :devCode, :doorCode, :inoutType)");
+
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":personId", object.value("person_id").toString());
+ query.bindValue(":datetime", object.value("date_time").toString());
+ query.bindValue(":recType", object.value("rec_type").toString());
+ query.bindValue(":devCode", object.value("dev_code").toString());
+ query.bindValue(":doorCode", object.value("door_code").toString());
+ query.bindValue(":inoutType", object.value("inout_type").toString());
+
+// LOG_DEBUG(sql.toStdString());
+
+ // 插入识别的log日志
+ QString logStr = QString("INSERT INTO RECOGNITION_LOGS (ID, LOG_INFO) VALUES (:id, :logInfo)");
+
+ QSqlQuery logQuery(ConnectionManager::getInstance()->getConnection());
+ logQuery.prepare(logStr);
+ logQuery.bindValue(":id", id);
+ logQuery.bindValue(":logInfo", object.value("debug_info").toString());
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行插入
+ bool success = query.exec();
+ logQuery.exec();
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ if (success == true)
+ {
+ return QString("%1").arg(id);
+ }
+ else
+ {
+ return "-1";
+ }
+}
+
+bool RecognitionRecordsDao::edit(QVariantMap newObject, QString id)
+{
+ return false;
+}
+
+bool RecognitionRecordsDao::dele(QString id)
+{
+ return false;
+}
diff --git a/dao/RecognitionRecordsDao.h b/dao/RecognitionRecordsDao.h
new file mode 100644
index 0000000..38de7c9
--- /dev/null
+++ b/dao/RecognitionRecordsDao.h
@@ -0,0 +1,23 @@
+#ifndef RECOGNITIONRECORDSDAO_H
+#define RECOGNITIONRECORDSDAO_H
+
+#include
+#include "BaseDao.h"
+class RecognitionRecordsDao: public BaseDao
+{
+ Q_OBJECT
+public:
+ explicit RecognitionRecordsDao(QObject *parent = nullptr);
+
+ QVector findAllRecord();
+ QVariantMap findRecordById(QString id);
+
+ QString save(QVariantMap object);
+ bool edit(QVariantMap newObject, QString id);
+ bool dele(QString id);
+
+signals:
+
+};
+
+#endif // RECOGNITIONRECORDSDAO_H
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/conf/config.ini b/conf/config.ini
new file mode 100644
index 0000000..66e46ad
--- /dev/null
+++ b/conf/config.ini
@@ -0,0 +1,67 @@
+[recognize]
+#最大允许识别时间(ms)
+maxMatchTime=10000
+#识别成功界面停留时间(ms)
+successTipsLast=5000
+#识别失败界面停留时间(ms)
+failureTipsLast=3000
+#人脸识别最大尝试次数
+maxFaceTryCount=20
+#持续没找到人脸的最大次数
+maxFaceNotFoundCount=500
+#注册时最小人脸
+minFaceRegist=240
+#识别时最小人脸
+minFaceRecog=100
+
+#虹膜识别最大尝试次数
+maxIrisTryCount=10
+#虹膜识别持续没有找到眼的最大次数
+maxEyeNotFoundCount=50
+
+#识别方式[1=人脸;2=虹膜;3=双认证;4=任意]
+recogType=4
+
+[window]
+#界面窗口宽(px)
+width=600
+#界面窗口高(px)
+height=1024
+#统一背景色
+backgroundColor="#FFFFFF"
+#标题
+title="虹膜识别终端"
+
+[work]
+#工作状态检测时最小人脸范围
+minFaceSize=160
+#人脸范围最小横坐标
+minFacePosX=320
+#人脸范围最大横坐标
+maxFacePosX=960
+#人脸范围最小纵坐标
+minFacePosY=180
+#人脸范围最大纵坐标
+maxFacePosY=540
+#人脸太近阈值
+faceCloseSize=360
+#人脸太远阈值
+faceFarSize=480
+
+[camera]
+#虹膜相机取一幅画面的时间间隔(ms)
+irisFrameInterval=100
+#虹膜相机拍摄宽度
+irisFrameWidth=1440
+#虹膜相机拍摄高度
+irisFrameHeight=1080
+#虹膜图像高度
+irisWidth=640
+#虹膜图像高度
+irisHeight=480
+
+[log]
+#日志文件位置
+logFile="d://irisLogs//casic_log.txt"
+#日志级别
+logLevel="trace"
diff --git a/dao/BaseDao.cpp b/dao/BaseDao.cpp
new file mode 100644
index 0000000..f51c144
--- /dev/null
+++ b/dao/BaseDao.cpp
@@ -0,0 +1,12 @@
+#include "BaseDao.h"
+#include "dao/util/ConnectionManager.h"
+
+BaseDao::BaseDao(QObject *parent) : QObject(parent)
+{
+
+}
+
+BaseDao::~BaseDao()
+{
+
+}
diff --git a/dao/BaseDao.h b/dao/BaseDao.h
new file mode 100644
index 0000000..1693c88
--- /dev/null
+++ b/dao/BaseDao.h
@@ -0,0 +1,32 @@
+#ifndef BASEDAO_H
+#define BASEDAO_H
+
+#include
+#include
+#include
+#include
+
+#include "dao/util/ConnectionManager.h"
+#include "utils/UtilInclude.h"
+
+class BaseDao : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BaseDao(QObject *parent = nullptr);
+ ~BaseDao();
+
+ virtual QVector findAllRecord() = 0;
+ virtual QVariantMap findRecordById(QString id) = 0;
+
+ virtual QString save(QVariantMap object) = 0;
+ virtual bool edit(QVariantMap newObject, QString id) = 0;
+ virtual bool dele(QString id) = 0;
+
+private:
+
+signals:
+
+};
+
+#endif // BASEDAO_H
diff --git a/dao/IrisDataDao.cpp b/dao/IrisDataDao.cpp
new file mode 100644
index 0000000..37a0ed6
--- /dev/null
+++ b/dao/IrisDataDao.cpp
@@ -0,0 +1,204 @@
+#include "IrisDataDao.h"
+
+IrisDataDao::IrisDataDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+QVector IrisDataDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM IRIS_DATA";
+ query.prepare(sql);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+
+ item.insert("id", query.value("id").toString());
+ item.insert("person_id", query.value("person_id").toString());
+ item.insert("id_card_no", query.value("id_card_no").toString());
+ item.insert("left_iris_code1", query.value("left_iris_code1"));
+ item.insert("left_iris_code2", query.value("left_iris_code2"));
+ item.insert("left_iris_code3", query.value("left_iris_code3"));
+ item.insert("right_iris_code1", query.value("right_iris_code1"));
+ item.insert("right_iris_code2", query.value("right_iris_code2"));
+ item.insert("right_iris_code3", query.value("right_iris_code3"));
+
+ result.append(item);
+ }
+
+// LOG_DEBUG(QString("查询IRIS_DATA表的所有记录[结果数:%1]").arg(result.size()).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordById(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ // 获取结果
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据id查询IRIS_DATA表的记录[id=%1]").arg(id).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordByPersonId(QString personId)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE PERSON_ID = :personId");
+ query.prepare(sql);
+ query.bindValue(":personId", personId);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据personId查询IRIS_DATA表的记录[personId=%1]").arg(personId).toStdString());
+ return result;
+}
+
+
+QString IrisDataDao::save(QVariantMap object)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ qulonglong id = ConnectionManager::getInstance()->generateId();
+
+ // INSERT语句
+ QString sql = QString("INSERT INTO IRIS_DATA (ID, PERSON_ID, ID_CARD_NO, LEFT_IRIS_CODE1, RIGHT_IRIS_CODE1) VALUES (:id, :personId, :idCardNo, :left1, :right1)");
+
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":personId", object.value("person_id").toString());
+ query.bindValue(":idCardNo", object.value("id_card_no").toString());
+ query.bindValue(":left1", object.value("left_iris_code1"));
+ query.bindValue(":right1", object.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行插入
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("保存虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ if (success == true)
+ {
+ return QString("%1").arg(id);
+ }
+ else
+ {
+ return "-1";
+ }
+}
+
+bool IrisDataDao::edit(QVariantMap newObject, QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // UPDATE语句
+ if (!newObject.contains("left_iris_code1") || !newObject.contains("right_iris_code1")){
+ return false;
+ }
+ QString sql = QString("UPDATE IRIS_DATA SET LEFT_IRIS_CODE1 = :left1, RIGHT_IRIS_CODE1 = :right1 WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":left1", newObject.value("left_iris_code1"));
+ query.bindValue(":right1", newObject.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("编辑虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
+
+
+bool IrisDataDao::dele(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ QString sql = QString("DELETE FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("删除虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
diff --git a/dao/IrisDataDao.h b/dao/IrisDataDao.h
new file mode 100644
index 0000000..c74dbbd
--- /dev/null
+++ b/dao/IrisDataDao.h
@@ -0,0 +1,25 @@
+#ifndef IRISDATADAO_H
+#define IRISDATADAO_H
+
+#include
+#include "BaseDao.h"
+
+class IrisDataDao : public BaseDao
+{
+ Q_OBJECT
+public:
+ explicit IrisDataDao(QObject *parent = nullptr);
+
+ QVector findAllRecord();
+ QVariantMap findRecordById(QString id);
+ QVariantMap findRecordByPersonId(QString personId);
+
+ QString save(QVariantMap object);
+ bool edit(QVariantMap newObject, QString id);
+ bool dele(QString id);
+
+signals:
+
+};
+
+#endif // IRISDATADAO_H
diff --git a/dao/RecognitionRecordsDao.cpp b/dao/RecognitionRecordsDao.cpp
new file mode 100644
index 0000000..40db453
--- /dev/null
+++ b/dao/RecognitionRecordsDao.cpp
@@ -0,0 +1,100 @@
+#include "RecognitionRecordsDao.h"
+
+RecognitionRecordsDao::RecognitionRecordsDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+
+QVector RecognitionRecordsDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM RECOGNITION_RECORDS";
+
+ // 执行查询
+ query.exec(sql);
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+
+ item.insert("id", query.value("id").toLongLong());
+ result.append(item);
+ }
+
+// LOG_DEBUG(QString("查询RECOGNITION_RECORDS表的所有记录[记录数:%1]").arg(result.size()).toStdString());
+ return result;
+}
+
+QVariantMap RecognitionRecordsDao::findRecordById(QString id)
+{
+ QVariantMap item;
+ return item;
+}
+
+QString RecognitionRecordsDao::save(QVariantMap object)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ qulonglong id = ConnectionManager::getInstance()->generateId();
+
+ // INSERT语句
+ QString sql = QString("INSERT INTO RECOGNITION_RECORDS (ID, PERSON_ID, DATETIME, REC_TYPE, DEV_CODE, DOOR_CODE, INOUT_TYPE) "
+ "VALUES (:id, :personId, :datetime, :recType, :devCode, :doorCode, :inoutType)");
+
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":personId", object.value("person_id").toString());
+ query.bindValue(":datetime", object.value("date_time").toString());
+ query.bindValue(":recType", object.value("rec_type").toString());
+ query.bindValue(":devCode", object.value("dev_code").toString());
+ query.bindValue(":doorCode", object.value("door_code").toString());
+ query.bindValue(":inoutType", object.value("inout_type").toString());
+
+// LOG_DEBUG(sql.toStdString());
+
+ // 插入识别的log日志
+ QString logStr = QString("INSERT INTO RECOGNITION_LOGS (ID, LOG_INFO) VALUES (:id, :logInfo)");
+
+ QSqlQuery logQuery(ConnectionManager::getInstance()->getConnection());
+ logQuery.prepare(logStr);
+ logQuery.bindValue(":id", id);
+ logQuery.bindValue(":logInfo", object.value("debug_info").toString());
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行插入
+ bool success = query.exec();
+ logQuery.exec();
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ if (success == true)
+ {
+ return QString("%1").arg(id);
+ }
+ else
+ {
+ return "-1";
+ }
+}
+
+bool RecognitionRecordsDao::edit(QVariantMap newObject, QString id)
+{
+ return false;
+}
+
+bool RecognitionRecordsDao::dele(QString id)
+{
+ return false;
+}
diff --git a/dao/RecognitionRecordsDao.h b/dao/RecognitionRecordsDao.h
new file mode 100644
index 0000000..38de7c9
--- /dev/null
+++ b/dao/RecognitionRecordsDao.h
@@ -0,0 +1,23 @@
+#ifndef RECOGNITIONRECORDSDAO_H
+#define RECOGNITIONRECORDSDAO_H
+
+#include
+#include "BaseDao.h"
+class RecognitionRecordsDao: public BaseDao
+{
+ Q_OBJECT
+public:
+ explicit RecognitionRecordsDao(QObject *parent = nullptr);
+
+ QVector findAllRecord();
+ QVariantMap findRecordById(QString id);
+
+ QString save(QVariantMap object);
+ bool edit(QVariantMap newObject, QString id);
+ bool dele(QString id);
+
+signals:
+
+};
+
+#endif // RECOGNITIONRECORDSDAO_H
diff --git a/dao/SysDeptDao.cpp b/dao/SysDeptDao.cpp
new file mode 100644
index 0000000..22f9946
--- /dev/null
+++ b/dao/SysDeptDao.cpp
@@ -0,0 +1,88 @@
+#include "SysDeptDao.h"
+
+SysDeptDao::SysDeptDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+QVector SysDeptDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM SYS_DEPT WHERE PID != '-1' ORDER BY PID, NUM";
+
+ // 执行查询
+ query.exec(sql);
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+ item.insert("id", query.value("id").toString());
+ item.insert("pid", query.value("pid").toString());
+ item.insert("pids", query.value("pids").toString());
+ item.insert("simplename", query.value("simplename").toString());
+ item.insert("fullname", query.value("fullname").toString());
+ }
+
+// LOG_TRACE(QString("查询表[SYS_DEPT]的所有记录[%1][%2]").arg(result.size()).arg(sql).toStdString());
+
+ return result;
+}
+
+QVariantMap SysDeptDao::findRecordById(QString id)
+{
+ QVariantMap item;
+ return item;
+
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM SYS_DEPT WHERE SYS_DEPT.ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ // 获取结果集的大小
+ query.last();
+ int count = query.at() + 1;
+
+ if (count >=1)
+ {
+ query.first();
+
+ result.insert("id", query.value("id").toString());
+ result.insert("pid", query.value("pid").toString());
+ result.insert("pids", query.value("pids").toString());
+ result.insert("simplename", query.value("simplename").toString());
+ result.insert("fullname", query.value("fullname").toString());
+ }
+
+// LOG_TRACE(QString("根据id查询SYS_DEPT表的记录[ID=%1][%2]").arg(id).arg(sql).toStdString());
+
+ return result;
+}
+
+
+QString SysDeptDao::save(QVariantMap object)
+{
+ return "0";
+}
+bool SysDeptDao::edit(QVariantMap newObject, QString id)
+{
+ return true;
+}
+bool SysDeptDao::dele(QString id)
+{
+ return true;
+}
diff --git a/AppConstants.h b/AppConstants.h
new file mode 100644
index 0000000..296c53f
--- /dev/null
+++ b/AppConstants.h
@@ -0,0 +1,28 @@
+#ifndef APPCONSTANTS_H
+#define APPCONSTANTS_H
+
+class AppConstants
+{
+public:
+ enum WidgeFrameName
+ {
+ MAIN_PAGE = 0, // 主页面
+ PERSON_LIST_FORM = 1, // 人员列表页面
+ ADD_PERSON_FORM = 2, // 添加人员页面
+ ADD_PERSON_CAPTURE_FACE = 21, // 添加/编辑人员时进行人脸拍图
+ ADD_PERSON_CAPTURE_IRIS = 22, // 添加/编辑人员时进行虹膜拍图
+ SETTING_FORM = 3, // 设置页面
+ RECOGNIZE_RESULT_FORM = 4, // 识别结果界面
+ IDENTIFY_FORM = 5, // 识别界面 含识别中 和 识别结果
+ LOCKSCREEN_FORM = 6 // 锁屏待机界面
+ };
+
+ enum ApplicationState
+ {
+ STATE_WAIT = 0, // 待机
+ STATE_WORKING = 1, // 工作状态
+ STATE_IDENTIFYING = 2, // 识别中
+ };
+};
+
+#endif // APPCONSTANTS_H
diff --git a/CasicIrisIdentify.pro b/CasicIrisIdentify.pro
index 5d7fea6..575ce3d 100644
--- a/CasicIrisIdentify.pro
+++ b/CasicIrisIdentify.pro
@@ -1,4 +1,4 @@
-QT += core gui
+QT += core gui sql network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -15,20 +15,46 @@
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-SOURCES += \
- main.cpp \
- IdentifyForm.cpp
+include("dao/dao.pri")
+include("device/device.pri")
+include("utils/utils.pri")
-HEADERS += \
- IdentifyForm.h
+SOURCES += main.cpp
+SOURCES += ProMemory.cpp
+SOURCES += MainWindowForm.cpp
+SOURCES += IdentifyForm.cpp
+SOURCES += LockScreenForm.cpp
-FORMS += \
- IdentifyForm.ui
+HEADERS += AppConstants.h
+HEADERS += ProMemory.h
+HEADERS += MainWindowForm.h
+HEADERS += IdentifyForm.h
+HEADERS += LockScreenForm.h
-TRANSLATIONS += \
- CasicIrisIdentify_zh_CN.ts
+FORMS += MainWindowForm.ui
+FORMS += IdentifyForm.ui
+FORMS += LockScreenForm.ui
+
+RESOURCES += resource.qrc
+
+DISTFILES += conf/config.ini
+
+#TRANSLATIONS += CasicIrisIdentify_zh_CN.ts
+
+#INCLUDEPATH += include/spdlog
+#DEPENDPATH += include/spdlog
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lopencv_world420
+unix:!macx|win32: LIBS += -L$$PWD/lib/ -lGxIAPICPPEx
+
+INCLUDEPATH += $$PWD/include/daheng
+DEPENDPATH += $$PWD/include/daheng
+
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD/include
diff --git a/CasicIrisIdentify_zh_CN.ts b/CasicIrisIdentify_zh_CN.ts
index 5526fe4..81900df 100644
--- a/CasicIrisIdentify_zh_CN.ts
+++ b/CasicIrisIdentify_zh_CN.ts
@@ -1,3 +1,12 @@
-
+
+
+ IdentifyForm
+
+
+ IdentifyForm
+
+
+
+
diff --git a/IdentifyForm.cpp b/IdentifyForm.cpp
index 348a897..ba1f251 100644
--- a/IdentifyForm.cpp
+++ b/IdentifyForm.cpp
@@ -1,4 +1,4 @@
-#include "IdentifyForm.h"
+#include "IdentifyForm.h"
#include "ui_IdentifyForm.h"
IdentifyForm::IdentifyForm(QWidget *parent)
@@ -6,6 +6,12 @@
, ui(new Ui::IdentifyForm)
{
ui->setupUi(this);
+
+ // 初始化更新界面的定时器
+ // 每秒执行一次
+ connect(TimeCounterUtil::getInstance().clockCounter, &QTimer::timeout, this, &IdentifyForm::updateDateAndTime);
+
+ TimeCounterUtil::getInstance().clockCounter->start(1000);
}
IdentifyForm::~IdentifyForm()
@@ -13,3 +19,16 @@
delete ui;
}
+void IdentifyForm::drawIrisImageOnFrame(QImage image)
+{
+ // 只在识别界面才显示画面
+ if (ui->wgtStacked->currentIndex() == 0) {
+ ui->labelVideo->setPixmap(QPixmap::fromImage(image));
+ }
+}
+
+
+void IdentifyForm::updateDateAndTime()
+{
+ ui->labelTime->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd dddd HH:mm:ss"));
+}
diff --git a/IdentifyForm.h b/IdentifyForm.h
index fc857a1..ae1cd22 100644
--- a/IdentifyForm.h
+++ b/IdentifyForm.h
@@ -1,7 +1,10 @@
-#ifndef IDENTIFYFORM_H
+#ifndef IDENTIFYFORM_H
#define IDENTIFYFORM_H
#include
+#include
+
+#include "utils/UtilInclude.h"
QT_BEGIN_NAMESPACE
namespace Ui { class IdentifyForm; }
@@ -15,7 +18,14 @@
IdentifyForm(QWidget *parent = nullptr);
~IdentifyForm();
+public slots:
+ void drawIrisImageOnFrame(QImage image);
+
private:
Ui::IdentifyForm *ui;
+
+private slots:
+ void updateDateAndTime();
+
};
#endif // IDENTIFYFORM_H
diff --git a/IdentifyForm.ui b/IdentifyForm.ui
index c72a36f..879dc9a 100644
--- a/IdentifyForm.ui
+++ b/IdentifyForm.ui
@@ -6,13 +6,59 @@
0
0
- 800
+ 600
600
IdentifyForm
+
+
+
+ 0
+ 40
+ 600
+ 450
+
+
+
+ 0
+
+
+
+
+
+ 100
+ 10
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 600
+ 40
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
diff --git a/LockScreenForm.cpp b/LockScreenForm.cpp
new file mode 100644
index 0000000..58dc54b
--- /dev/null
+++ b/LockScreenForm.cpp
@@ -0,0 +1,14 @@
+#include "LockScreenForm.h"
+#include "ui_LockScreenForm.h"
+
+LockScreenForm::LockScreenForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::LockScreenForm)
+{
+ ui->setupUi(this);
+}
+
+LockScreenForm::~LockScreenForm()
+{
+ delete ui;
+}
diff --git a/LockScreenForm.h b/LockScreenForm.h
new file mode 100644
index 0000000..b5ded48
--- /dev/null
+++ b/LockScreenForm.h
@@ -0,0 +1,25 @@
+#ifndef LOCKSCREENFORM_H
+#define LOCKSCREENFORM_H
+
+#include
+#include
+
+#include "utils/UtilInclude.h"
+
+namespace Ui {
+class LockScreenForm;
+}
+
+class LockScreenForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LockScreenForm(QWidget *parent = nullptr);
+ ~LockScreenForm();
+
+private:
+ Ui::LockScreenForm *ui;
+};
+
+#endif // LOCKSCREENFORM_H
diff --git a/LockScreenForm.ui b/LockScreenForm.ui
new file mode 100644
index 0000000..7f2a6db
--- /dev/null
+++ b/LockScreenForm.ui
@@ -0,0 +1,45 @@
+
+
+ LockScreenForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+ 180
+ 100
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+ 180
+ 160
+ 54
+ 12
+
+
+
+ TextLabel
+
+
+
+
+
+
diff --git a/MainWindowForm.cpp b/MainWindowForm.cpp
new file mode 100644
index 0000000..84f8159
--- /dev/null
+++ b/MainWindowForm.cpp
@@ -0,0 +1,86 @@
+#include "MainWindowForm.h"
+#include "ui_MainWindowForm.h"
+#include
+
+MainWindowForm::MainWindowForm(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MainWindowForm)
+{
+ ui->setupUi(this);
+
+ // 设置窗口透明和大小、位置
+ this->setWindowFlags(Qt::FramelessWindowHint);
+ this->move(1400, 15);
+ this->resize(SettingConfig::getInstance().WINDOW_WIDTH, SettingConfig::getInstance().WINDOW_HEIGHT);
+
+ // 通过调色板的颜色来设置窗口的统一背景色
+ qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR)));
+
+ // 加载css文件设置控件样式
+ QFile file(QApplication::applicationDirPath() + "/qss/main.css");
+ if (file.open(QFile::ReadOnly))
+ {
+ QString qssStr = QLatin1String(file.readAll());
+ this->setStyleSheet(qssStr);
+ file.close();
+ }
+
+ initFormsPtr();
+
+ // 设置标题文字
+ ui->labelTitle->setText(SettingConfig::getInstance().WINDOW_TITLE);
+ ui->labelCopyright->setText(SettingConfig::getInstance().WINDOW_RIGHTS);
+ ui->labelVersion->setText(SettingConfig::getInstance().WINDOW_VERSION);
+
+ // 初始化虹膜相机控制
+ ProMemory::getInstance().irisCam = new IrisCameraController(this);
+ ProMemory::getInstance().irisCam->initIrisCamera();
+ ProMemory::getInstance().irisCam->openIrisCamera();
+ connect(ProMemory::getInstance().irisCam->irisCamHandler, &IrisCameraCapEventHandler::sendIrisFrameToDraw, identifyForm, &IdentifyForm::drawIrisImageOnFrame);
+
+// LOG_INFO(QString("应用程序启动成功[Application Startup Success]").toStdString());
+ qDebug() << "应用程序启动成功[Application Startup Success]";
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::IDENTIFY_FORM;
+ ui->wdgtStatced->setCurrentWidget(identifyForm);
+
+ // 开始虹膜相机拍图
+ ProMemory::getInstance().irisCam->startCapture();
+}
+
+MainWindowForm::~MainWindowForm()
+{
+ delete ui;
+}
+
+void MainWindowForm::lockScreen()
+{
+ ui->wdgtStatced->setCurrentWidget(lockScreenForm);
+ ProMemory::getInstance().widgeFrame = AppConstants::WidgeFrameName::LOCKSCREEN_FORM;
+ ProMemory::getInstance().appState = AppConstants::ApplicationState::STATE_WAIT;
+}
+
+void MainWindowForm::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ QTimer::singleShot(100, qApp, [=](){
+ QApplication::quit();
+ });
+
+ default:
+ QWidget::keyPressEvent(event);
+ }
+}
+
+void MainWindowForm::initFormsPtr()
+{
+ // 初始化各个form
+ lockScreenForm = new LockScreenForm(this);
+ identifyForm = new IdentifyForm(this);
+
+ // 将form添加到statcked widget中
+ ui->wdgtStatced->addWidget(identifyForm);
+ ui->wdgtStatced->addWidget(lockScreenForm);
+
+ // 绑定按钮函数
+}
diff --git a/MainWindowForm.h b/MainWindowForm.h
new file mode 100644
index 0000000..7fb2d89
--- /dev/null
+++ b/MainWindowForm.h
@@ -0,0 +1,38 @@
+#ifndef MAINWINDOWFORM_H
+#define MAINWINDOWFORM_H
+
+#include
+#include
+#include
+
+#include "utils/UtilInclude.h"
+#include "ProMemory.h"
+#include "LockScreenForm.h"
+#include "IdentifyForm.h"
+
+namespace Ui {
+class MainWindowForm;
+}
+
+class MainWindowForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindowForm(QWidget *parent = nullptr);
+ ~MainWindowForm();
+
+public slots:
+ void lockScreen();
+
+private:
+ Ui::MainWindowForm *ui;
+ LockScreenForm * lockScreenForm;
+ IdentifyForm * identifyForm;
+
+ void keyPressEvent(QKeyEvent *event);
+
+ void initFormsPtr();
+};
+
+#endif // MAINWINDOWFORM_H
diff --git a/MainWindowForm.ui b/MainWindowForm.ui
new file mode 100644
index 0000000..e793ebf
--- /dev/null
+++ b/MainWindowForm.ui
@@ -0,0 +1,85 @@
+
+
+ MainWindowForm
+
+
+
+ 0
+ 0
+ 600
+ 1024
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+ 0
+ 0
+ 600
+ 84
+
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+ -
+
+
+ -
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProMemory.cpp b/ProMemory.cpp
new file mode 100644
index 0000000..19e7403
--- /dev/null
+++ b/ProMemory.cpp
@@ -0,0 +1,84 @@
+#include "ProMemory.h"
+
+ProMemory::ProMemory()
+{
+
+}
+
+ProMemory::~ProMemory()
+{
+
+}
+
+/*
+void ProMemory::pushCasicIris(CasicIrisInfo irisInfo)
+{
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 30)
+ {
+ QStack empty;
+ std::swap(empty, irisQueue);
+ }
+
+ irisQueue.push(irisInfo);
+ mutex.unlock();
+}
+CasicIrisInfo ProMemory::popCasicIris()
+{
+ CasicIrisInfo result;
+
+ QMutex mutex;
+ mutex.lock();
+ if (this->irisQueue.size() > 0)
+ {
+ result = irisQueue.pop();
+ }
+
+ mutex.unlock();
+
+ return result;
+}
+*/
+int ProMemory::getIrisQueueSize()
+{
+ int size = 0;
+
+ QMutex mutex;
+ mutex.lock();
+
+// size = this->irisQueue.size();
+
+ mutex.unlock();
+
+ return size;
+}
+bool ProMemory::isIrisQueueEmpty()
+{
+ bool empty = true;
+
+ QMutex mutex;
+ mutex.lock();
+
+// empty = this->irisQueue.isEmpty();
+
+ mutex.unlock();
+
+ return empty;
+}
+void ProMemory::clearIrisQueue()
+{
+ QMutex mutex;
+ mutex.lock();
+
+// QStack empty;
+// std::swap(empty, irisQueue);
+
+ mutex.unlock();
+}
+
+
+void ProMemory::initIrisFeatures(QString personId)
+{
+// irisRegistPro->sendDataToExract(QByteArray(QString("[-u]").append(personId).toLocal8Bit()));
+}
diff --git a/ProMemory.h b/ProMemory.h
new file mode 100644
index 0000000..2ecd653
--- /dev/null
+++ b/ProMemory.h
@@ -0,0 +1,52 @@
+#ifndef PROMEMORY_H
+#define PROMEMORY_H
+
+#include
+#include
+
+#include "AppConstants.h"
+//#include "casic/iris/CasicIrisInfo.h"
+#include "dao/IrisDataDao.h"
+
+#include "device/IrisCameraController.h"
+//#include "device/iris/IrisRegistProcess.h"
+//#include "device/iris/IrisRecogProcess.h"
+
+class IrisCameraController;
+class IrisRegistProcess;
+class IrisRecogProcess;
+
+class ProMemory
+{
+public:
+ ~ProMemory();
+ ProMemory(const ProMemory&)=delete;
+ ProMemory& operator=(const ProMemory&)=delete;
+
+ static ProMemory& getInstance() {
+ static ProMemory instance;
+ return instance;
+ }
+
+// void pushCasicIris(CasicIrisInfo irisInfo);
+// CasicIrisInfo popCasicIris();
+ int getIrisQueueSize();
+ bool isIrisQueueEmpty();
+ void clearIrisQueue();
+
+ volatile int widgeFrame = 0; // 当前显示的界面
+ volatile int appState = 0; // 当前程序所处的状态
+
+ void initIrisFeatures(QString personId = ""); // 初始化虹膜特征值集合
+
+ IrisCameraController * irisCam;
+ IrisRecogProcess * irisRecogPro;
+
+private:
+ ProMemory();
+
+// QStack irisQueue; // 虹膜信息队列
+ QVector irisFeatures; // 虹膜特征值集合
+};
+
+#endif // PROMEMORY_H
diff --git a/conf/config.ini b/conf/config.ini
new file mode 100644
index 0000000..66e46ad
--- /dev/null
+++ b/conf/config.ini
@@ -0,0 +1,67 @@
+[recognize]
+#最大允许识别时间(ms)
+maxMatchTime=10000
+#识别成功界面停留时间(ms)
+successTipsLast=5000
+#识别失败界面停留时间(ms)
+failureTipsLast=3000
+#人脸识别最大尝试次数
+maxFaceTryCount=20
+#持续没找到人脸的最大次数
+maxFaceNotFoundCount=500
+#注册时最小人脸
+minFaceRegist=240
+#识别时最小人脸
+minFaceRecog=100
+
+#虹膜识别最大尝试次数
+maxIrisTryCount=10
+#虹膜识别持续没有找到眼的最大次数
+maxEyeNotFoundCount=50
+
+#识别方式[1=人脸;2=虹膜;3=双认证;4=任意]
+recogType=4
+
+[window]
+#界面窗口宽(px)
+width=600
+#界面窗口高(px)
+height=1024
+#统一背景色
+backgroundColor="#FFFFFF"
+#标题
+title="虹膜识别终端"
+
+[work]
+#工作状态检测时最小人脸范围
+minFaceSize=160
+#人脸范围最小横坐标
+minFacePosX=320
+#人脸范围最大横坐标
+maxFacePosX=960
+#人脸范围最小纵坐标
+minFacePosY=180
+#人脸范围最大纵坐标
+maxFacePosY=540
+#人脸太近阈值
+faceCloseSize=360
+#人脸太远阈值
+faceFarSize=480
+
+[camera]
+#虹膜相机取一幅画面的时间间隔(ms)
+irisFrameInterval=100
+#虹膜相机拍摄宽度
+irisFrameWidth=1440
+#虹膜相机拍摄高度
+irisFrameHeight=1080
+#虹膜图像高度
+irisWidth=640
+#虹膜图像高度
+irisHeight=480
+
+[log]
+#日志文件位置
+logFile="d://irisLogs//casic_log.txt"
+#日志级别
+logLevel="trace"
diff --git a/dao/BaseDao.cpp b/dao/BaseDao.cpp
new file mode 100644
index 0000000..f51c144
--- /dev/null
+++ b/dao/BaseDao.cpp
@@ -0,0 +1,12 @@
+#include "BaseDao.h"
+#include "dao/util/ConnectionManager.h"
+
+BaseDao::BaseDao(QObject *parent) : QObject(parent)
+{
+
+}
+
+BaseDao::~BaseDao()
+{
+
+}
diff --git a/dao/BaseDao.h b/dao/BaseDao.h
new file mode 100644
index 0000000..1693c88
--- /dev/null
+++ b/dao/BaseDao.h
@@ -0,0 +1,32 @@
+#ifndef BASEDAO_H
+#define BASEDAO_H
+
+#include
+#include
+#include
+#include
+
+#include "dao/util/ConnectionManager.h"
+#include "utils/UtilInclude.h"
+
+class BaseDao : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BaseDao(QObject *parent = nullptr);
+ ~BaseDao();
+
+ virtual QVector findAllRecord() = 0;
+ virtual QVariantMap findRecordById(QString id) = 0;
+
+ virtual QString save(QVariantMap object) = 0;
+ virtual bool edit(QVariantMap newObject, QString id) = 0;
+ virtual bool dele(QString id) = 0;
+
+private:
+
+signals:
+
+};
+
+#endif // BASEDAO_H
diff --git a/dao/IrisDataDao.cpp b/dao/IrisDataDao.cpp
new file mode 100644
index 0000000..37a0ed6
--- /dev/null
+++ b/dao/IrisDataDao.cpp
@@ -0,0 +1,204 @@
+#include "IrisDataDao.h"
+
+IrisDataDao::IrisDataDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+QVector IrisDataDao::findAllRecord()
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = "SELECT * FROM IRIS_DATA";
+ query.prepare(sql);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVector result;
+
+ // 遍历查询结果
+ while (query.next()) {
+ QVariantMap item;
+
+ item.insert("id", query.value("id").toString());
+ item.insert("person_id", query.value("person_id").toString());
+ item.insert("id_card_no", query.value("id_card_no").toString());
+ item.insert("left_iris_code1", query.value("left_iris_code1"));
+ item.insert("left_iris_code2", query.value("left_iris_code2"));
+ item.insert("left_iris_code3", query.value("left_iris_code3"));
+ item.insert("right_iris_code1", query.value("right_iris_code1"));
+ item.insert("right_iris_code2", query.value("right_iris_code2"));
+ item.insert("right_iris_code3", query.value("right_iris_code3"));
+
+ result.append(item);
+ }
+
+// LOG_DEBUG(QString("查询IRIS_DATA表的所有记录[结果数:%1]").arg(result.size()).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordById(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ // 获取结果
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据id查询IRIS_DATA表的记录[id=%1]").arg(id).toStdString());
+ return result;
+}
+
+QVariantMap IrisDataDao::findRecordByPersonId(QString personId)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // 查询语句
+ QString sql = QString("SELECT * FROM IRIS_DATA WHERE PERSON_ID = :personId");
+ query.prepare(sql);
+ query.bindValue(":personId", personId);
+
+ // 执行查询
+ query.exec();
+
+ // 返回结果
+ QVariantMap result;
+
+ if (query.next())
+ {
+ result.insert("id", query.value("id").toString());
+ result.insert("person_id", query.value("person_id").toLongLong());
+ result.insert("id_card_no", query.value("id_card_no").toString());
+ result.insert("left_iris_code1", query.value("left_iris_code1"));
+ result.insert("left_iris_code2", query.value("left_iris_code2"));
+ result.insert("left_iris_code3", query.value("left_iris_code3"));
+ result.insert("right_iris_code1", query.value("right_iris_code1"));
+ result.insert("right_iris_code2", query.value("right_iris_code2"));
+ result.insert("right_iris_code3", query.value("right_iris_code3"));
+ }
+
+// LOG_DEBUG(QString("根据personId查询IRIS_DATA表的记录[personId=%1]").arg(personId).toStdString());
+ return result;
+}
+
+
+QString IrisDataDao::save(QVariantMap object)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ qulonglong id = ConnectionManager::getInstance()->generateId();
+
+ // INSERT语句
+ QString sql = QString("INSERT INTO IRIS_DATA (ID, PERSON_ID, ID_CARD_NO, LEFT_IRIS_CODE1, RIGHT_IRIS_CODE1) VALUES (:id, :personId, :idCardNo, :left1, :right1)");
+
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":personId", object.value("person_id").toString());
+ query.bindValue(":idCardNo", object.value("id_card_no").toString());
+ query.bindValue(":left1", object.value("left_iris_code1"));
+ query.bindValue(":right1", object.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行插入
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("保存虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ if (success == true)
+ {
+ return QString("%1").arg(id);
+ }
+ else
+ {
+ return "-1";
+ }
+}
+
+bool IrisDataDao::edit(QVariantMap newObject, QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ // UPDATE语句
+ if (!newObject.contains("left_iris_code1") || !newObject.contains("right_iris_code1")){
+ return false;
+ }
+ QString sql = QString("UPDATE IRIS_DATA SET LEFT_IRIS_CODE1 = :left1, RIGHT_IRIS_CODE1 = :right1 WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+ query.bindValue(":left1", newObject.value("left_iris_code1"));
+ query.bindValue(":right1", newObject.value("right_iris_code1"));
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("编辑虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
+
+
+bool IrisDataDao::dele(QString id)
+{
+ // 新建查询
+ QSqlQuery query(ConnectionManager::getInstance()->getConnection());
+
+ QString sql = QString("DELETE FROM IRIS_DATA WHERE ID = :id");
+ query.prepare(sql);
+ query.bindValue(":id", id);
+
+ // 开启事务
+ ConnectionManager::getInstance()->getConnection().transaction();
+
+ // 执行更新
+ bool success = query.exec();
+
+// LOG_DEBUG(QString("删除虹膜特征值[%1][id=%2]").arg(success).arg(id).toStdString());
+
+ // 结束事务
+ ConnectionManager::getInstance()->getConnection().commit();
+
+ // 返回结果
+ return success;
+}
diff --git a/dao/IrisDataDao.h b/dao/IrisDataDao.h
new file mode 100644
index 0000000..c74dbbd
--- /dev/null
+++ b/dao/IrisDataDao.h
@@ -0,0 +1,25 @@
+#ifndef IRISDATADAO_H
+#define IRISDATADAO_H
+
+#include
+#include "BaseDao.h"
+
+class IrisDataDao : public BaseDao
+{
+ Q_OBJECT
+public:
+ explicit IrisDataDao(QObject *parent = nullptr);
+
+ QVector findAllRecord();
+ QVariantMap findRecordById(QString id);
+ QVariantMap findRecordByPersonId(QString personId);
+
+ QString save(QVariantMap object);
+ bool edit(QVariantMap newObject, QString id);
+ bool dele(QString id);
+
+signals:
+
+};
+
+#endif // IRISDATADAO_H
diff --git a/dao/RecognitionRecordsDao.cpp b/dao/RecognitionRecordsDao.cpp
new file mode 100644
index 0000000..40db453
--- /dev/null
+++ b/dao/RecognitionRecordsDao.cpp
@@ -0,0 +1,100 @@
+#include "RecognitionRecordsDao.h"
+
+RecognitionRecordsDao::RecognitionRecordsDao(QObject *parent) : BaseDao(parent)
+{
+
+}
+
+
+QVector