├── .github ├── FUNDING.yml └── workflows │ ├── android.yml │ ├── build.yml │ ├── codespell.yml │ ├── doxygen.yml │ ├── macos.yml │ ├── mingw.yml │ ├── msvc.yml │ └── ubuntu.yml ├── .gitignore ├── .travis.yml ├── App ├── AppIcon.rc ├── CMakeLists.txt ├── DelegateParamter.cpp ├── DelegateParamter.h ├── FrmBrowseFile.cpp ├── FrmBrowseFile.h ├── FrmBrowseFile.ui ├── FrmDisplay.cpp ├── FrmDisplay.h ├── FrmDisplay.ui ├── FrmPara.cpp ├── FrmPara.h ├── FrmPara.ui ├── FrmRecognizerImage.cpp ├── FrmRecognizerImage.h ├── FrmRecognizerImage.ui ├── FrmRecognizerVideo.cpp ├── FrmRecognizerVideo.h ├── FrmRecognizerVideo.ui ├── FrmRegisterImage.cpp ├── FrmRegisterImage.h ├── FrmRegisterImage.ui ├── FrmRegisterVideo.cpp ├── FrmRegisterVideo.h ├── FrmRegisterVideo.ui ├── MainWindow.cpp ├── MainWindow.h ├── MainWindow.ui ├── ManageRecognizerVideo.cpp ├── ManageRecognizerVideo.h ├── ManageRecognizerVideo.ui ├── ManageRegisterVideo.cpp ├── ManageRegisterVideo.h ├── ParameterRegisterImage.cpp ├── ParameterRegisterImage.h ├── RecognizerThread.cpp ├── RecognizerThread.h ├── RecognizerVideo.cpp ├── RecognizerVideo.h ├── Resource │ ├── Resource.qrc │ ├── Translations │ │ ├── FaceRecognizerApp_ar.ts │ │ ├── FaceRecognizerApp_ca.ts │ │ ├── FaceRecognizerApp_cs.ts │ │ ├── FaceRecognizerApp_da.ts │ │ ├── FaceRecognizerApp_de.ts │ │ ├── FaceRecognizerApp_el.ts │ │ ├── FaceRecognizerApp_en.ts │ │ ├── FaceRecognizerApp_en_GB.ts │ │ ├── FaceRecognizerApp_es.ts │ │ ├── FaceRecognizerApp_et.ts │ │ ├── FaceRecognizerApp_fi.ts │ │ ├── FaceRecognizerApp_fr.ts │ │ ├── FaceRecognizerApp_gd.ts │ │ ├── FaceRecognizerApp_gl.ts │ │ ├── FaceRecognizerApp_hu.ts │ │ ├── FaceRecognizerApp_it.ts │ │ ├── FaceRecognizerApp_ja.ts │ │ ├── FaceRecognizerApp_ko.ts │ │ ├── FaceRecognizerApp_nb.ts │ │ ├── FaceRecognizerApp_ne.ts │ │ ├── FaceRecognizerApp_nl.ts │ │ ├── FaceRecognizerApp_nn.ts │ │ ├── FaceRecognizerApp_oc.ts │ │ ├── FaceRecognizerApp_pl.ts │ │ ├── FaceRecognizerApp_pt_BR.ts │ │ ├── FaceRecognizerApp_pt_PT.ts │ │ ├── FaceRecognizerApp_ro.ts │ │ ├── FaceRecognizerApp_ru.ts │ │ ├── FaceRecognizerApp_sk.ts │ │ ├── FaceRecognizerApp_sl.ts │ │ ├── FaceRecognizerApp_sv.ts │ │ ├── FaceRecognizerApp_th.ts │ │ ├── FaceRecognizerApp_tr.ts │ │ ├── FaceRecognizerApp_uk.ts │ │ ├── FaceRecognizerApp_zh_CN.ts │ │ └── FaceRecognizerApp_zh_TW.ts │ ├── icons │ │ ├── rabbit-black │ │ │ ├── index.theme │ │ │ └── svg │ │ │ │ ├── face-recognizer.svg │ │ │ │ ├── image.svg │ │ │ │ ├── register.svg │ │ │ │ ├── video-file.svg │ │ │ │ └── video-folder.svg │ │ ├── rabbit-green │ │ │ ├── index.theme │ │ │ └── svg │ │ │ │ ├── face-recognizer.svg │ │ │ │ ├── image.svg │ │ │ │ ├── register.svg │ │ │ │ ├── video-file.svg │ │ │ │ └── video-folder.svg │ │ ├── rabbit-red │ │ │ ├── index.theme │ │ │ └── svg │ │ │ │ ├── face-recognizer.svg │ │ │ │ ├── image.svg │ │ │ │ ├── register.svg │ │ │ │ ├── video-file.svg │ │ │ │ └── video-folder.svg │ │ └── rabbit-white │ │ │ ├── index.theme │ │ │ └── svg │ │ │ ├── face-recognizer.svg │ │ │ ├── image.svg │ │ │ ├── register.svg │ │ │ ├── video-file.svg │ │ │ └── video-folder.svg │ └── image │ │ ├── FaceRecognizer.ico │ │ └── FaceRecognizer.png ├── android │ ├── AndroidManifest.xml │ └── res │ │ ├── drawable-hdpi │ │ └── icon.png │ │ ├── drawable-ldpi │ │ └── icon.png │ │ ├── drawable-mdpi │ │ └── icon.png │ │ ├── values-zh │ │ └── strings.xml │ │ └── values │ │ └── strings.xml └── main.cpp ├── Authors.md ├── Authors_zh_CN.md ├── CMakeLists.txt ├── CMakePresets.json ├── ChangeLog.md ├── ChangeLog_zh_CN.md ├── Donate.md ├── Install ├── Install.nsi └── install.sh ├── License.md ├── README.md ├── Resource ├── ResourceSql.qrc └── db │ └── database.sql ├── Src ├── CMakeLists.txt ├── CameraQtCaptureVideoFrame.cpp ├── CameraQtCaptureVideoFrame.h ├── ConverFormat.cpp ├── ConverFormat.h ├── Detector.cpp ├── Detector.h ├── Face.cpp ├── Face.h ├── FaceBase.cpp ├── FaceBase.h ├── FaceTools.cpp ├── FaceTools.h ├── FactoryFace.cpp ├── FactoryFace.h ├── ImageTool.cpp ├── ImageTool.h ├── Landmarker.cpp ├── Landmarker.h ├── Performance.cpp ├── Performance.h ├── Plugins │ ├── CMakeLists.txt │ ├── FFmpge │ │ ├── CMakeLists.txt │ │ ├── ConverFormatFFmpeg.cpp │ │ ├── ConverFormatFFmpeg.h │ │ └── Resource │ │ │ └── Translations │ │ │ ├── PluginConverFormatFFMpeg_ar.ts │ │ │ ├── PluginConverFormatFFMpeg_ca.ts │ │ │ ├── PluginConverFormatFFMpeg_cs.ts │ │ │ ├── PluginConverFormatFFMpeg_da.ts │ │ │ ├── PluginConverFormatFFMpeg_de.ts │ │ │ ├── PluginConverFormatFFMpeg_el.ts │ │ │ ├── PluginConverFormatFFMpeg_en.ts │ │ │ ├── PluginConverFormatFFMpeg_en_GB.ts │ │ │ ├── PluginConverFormatFFMpeg_es.ts │ │ │ ├── PluginConverFormatFFMpeg_et.ts │ │ │ ├── PluginConverFormatFFMpeg_fi.ts │ │ │ ├── PluginConverFormatFFMpeg_fr.ts │ │ │ ├── PluginConverFormatFFMpeg_gd.ts │ │ │ ├── PluginConverFormatFFMpeg_gl.ts │ │ │ ├── PluginConverFormatFFMpeg_hu.ts │ │ │ ├── PluginConverFormatFFMpeg_it.ts │ │ │ ├── PluginConverFormatFFMpeg_ja.ts │ │ │ ├── PluginConverFormatFFMpeg_ko.ts │ │ │ ├── PluginConverFormatFFMpeg_nb.ts │ │ │ ├── PluginConverFormatFFMpeg_ne.ts │ │ │ ├── PluginConverFormatFFMpeg_nl.ts │ │ │ ├── PluginConverFormatFFMpeg_nn.ts │ │ │ ├── PluginConverFormatFFMpeg_oc.ts │ │ │ ├── PluginConverFormatFFMpeg_pl.ts │ │ │ ├── PluginConverFormatFFMpeg_pt_BR.ts │ │ │ ├── PluginConverFormatFFMpeg_pt_PT.ts │ │ │ ├── PluginConverFormatFFMpeg_ro.ts │ │ │ ├── PluginConverFormatFFMpeg_ru.ts │ │ │ ├── PluginConverFormatFFMpeg_sk.ts │ │ │ ├── PluginConverFormatFFMpeg_sl.ts │ │ │ ├── PluginConverFormatFFMpeg_sv.ts │ │ │ ├── PluginConverFormatFFMpeg_th.ts │ │ │ ├── PluginConverFormatFFMpeg_tr.ts │ │ │ ├── PluginConverFormatFFMpeg_uk.ts │ │ │ ├── PluginConverFormatFFMpeg_zh_CN.ts │ │ │ └── PluginConverFormatFFMpeg_zh_TW.ts │ ├── LibFacedetection │ │ ├── CMakeLists.txt │ │ ├── DetectorLibfacedetection.cpp │ │ ├── DetectorLibfacedetection.h │ │ ├── FaceLibfacedetection.cpp │ │ └── FaceLibfacedetection.h │ ├── OpenCV │ │ ├── CMakeLists.txt │ │ ├── ConverFormatOpenCV.cpp │ │ ├── ConverFormatOpenCV.h │ │ ├── DetectorOpenCV.cpp │ │ ├── DetectorOpenCV.h │ │ ├── DetectorOpenCVDNN.cpp │ │ ├── DetectorOpenCVDNN.h │ │ ├── FaceOpenCV.cpp │ │ ├── FaceOpenCV.h │ │ ├── FaceOpenCVDNN.cpp │ │ ├── FaceOpenCVDNN.h │ │ ├── LandmarkerOpenCV.cpp │ │ ├── LandmarkerOpenCV.h │ │ ├── OpenCV_DNN.cmake │ │ ├── OpenCV_Face.cmake │ │ ├── RecognizerOpenCV.cpp │ │ ├── RecognizerOpenCV.h │ │ └── Resource │ │ │ └── Translations │ │ │ ├── PluginConverFormatOpenCV_ar.ts │ │ │ ├── PluginConverFormatOpenCV_ca.ts │ │ │ ├── PluginConverFormatOpenCV_cs.ts │ │ │ ├── PluginConverFormatOpenCV_da.ts │ │ │ ├── PluginConverFormatOpenCV_de.ts │ │ │ ├── PluginConverFormatOpenCV_el.ts │ │ │ ├── PluginConverFormatOpenCV_en.ts │ │ │ ├── PluginConverFormatOpenCV_en_GB.ts │ │ │ ├── PluginConverFormatOpenCV_es.ts │ │ │ ├── PluginConverFormatOpenCV_et.ts │ │ │ ├── PluginConverFormatOpenCV_fi.ts │ │ │ ├── PluginConverFormatOpenCV_fr.ts │ │ │ ├── PluginConverFormatOpenCV_gd.ts │ │ │ ├── PluginConverFormatOpenCV_gl.ts │ │ │ ├── PluginConverFormatOpenCV_hu.ts │ │ │ ├── PluginConverFormatOpenCV_it.ts │ │ │ ├── PluginConverFormatOpenCV_ja.ts │ │ │ ├── PluginConverFormatOpenCV_ko.ts │ │ │ ├── PluginConverFormatOpenCV_nb.ts │ │ │ ├── PluginConverFormatOpenCV_ne.ts │ │ │ ├── PluginConverFormatOpenCV_nl.ts │ │ │ ├── PluginConverFormatOpenCV_nn.ts │ │ │ ├── PluginConverFormatOpenCV_oc.ts │ │ │ ├── PluginConverFormatOpenCV_pl.ts │ │ │ ├── PluginConverFormatOpenCV_pt_BR.ts │ │ │ ├── PluginConverFormatOpenCV_pt_PT.ts │ │ │ ├── PluginConverFormatOpenCV_ro.ts │ │ │ ├── PluginConverFormatOpenCV_ru.ts │ │ │ ├── PluginConverFormatOpenCV_sk.ts │ │ │ ├── PluginConverFormatOpenCV_sl.ts │ │ │ ├── PluginConverFormatOpenCV_sv.ts │ │ │ ├── PluginConverFormatOpenCV_th.ts │ │ │ ├── PluginConverFormatOpenCV_tr.ts │ │ │ ├── PluginConverFormatOpenCV_uk.ts │ │ │ ├── PluginConverFormatOpenCV_zh_CN.ts │ │ │ ├── PluginConverFormatOpenCV_zh_TW.ts │ │ │ ├── PluginFaceOpencvFace_ar.ts │ │ │ ├── PluginFaceOpencvFace_ca.ts │ │ │ ├── PluginFaceOpencvFace_cs.ts │ │ │ ├── PluginFaceOpencvFace_da.ts │ │ │ ├── PluginFaceOpencvFace_de.ts │ │ │ ├── PluginFaceOpencvFace_el.ts │ │ │ ├── PluginFaceOpencvFace_en.ts │ │ │ ├── PluginFaceOpencvFace_en_GB.ts │ │ │ ├── PluginFaceOpencvFace_es.ts │ │ │ ├── PluginFaceOpencvFace_et.ts │ │ │ ├── PluginFaceOpencvFace_fi.ts │ │ │ ├── PluginFaceOpencvFace_fr.ts │ │ │ ├── PluginFaceOpencvFace_gd.ts │ │ │ ├── PluginFaceOpencvFace_gl.ts │ │ │ ├── PluginFaceOpencvFace_hu.ts │ │ │ ├── PluginFaceOpencvFace_it.ts │ │ │ ├── PluginFaceOpencvFace_ja.ts │ │ │ ├── PluginFaceOpencvFace_ko.ts │ │ │ ├── PluginFaceOpencvFace_nb.ts │ │ │ ├── PluginFaceOpencvFace_ne.ts │ │ │ ├── PluginFaceOpencvFace_nl.ts │ │ │ ├── PluginFaceOpencvFace_nn.ts │ │ │ ├── PluginFaceOpencvFace_oc.ts │ │ │ ├── PluginFaceOpencvFace_pl.ts │ │ │ ├── PluginFaceOpencvFace_pt_BR.ts │ │ │ ├── PluginFaceOpencvFace_pt_PT.ts │ │ │ ├── PluginFaceOpencvFace_ro.ts │ │ │ ├── PluginFaceOpencvFace_ru.ts │ │ │ ├── PluginFaceOpencvFace_sk.ts │ │ │ ├── PluginFaceOpencvFace_sl.ts │ │ │ ├── PluginFaceOpencvFace_sv.ts │ │ │ ├── PluginFaceOpencvFace_th.ts │ │ │ ├── PluginFaceOpencvFace_tr.ts │ │ │ ├── PluginFaceOpencvFace_uk.ts │ │ │ ├── PluginFaceOpencvFace_zh_CN.ts │ │ │ └── PluginFaceOpencvFace_zh_TW.ts │ ├── Seeta │ │ ├── CMakeLists.txt │ │ ├── DetectorSeeta.cpp │ │ ├── DetectorSeeta.h │ │ ├── FaceSeeta2.cpp │ │ ├── FaceSeeta2.h │ │ ├── FaceToolsSeeta.cpp │ │ ├── FaceToolsSeeta.h │ │ ├── LandmarkerSeeta.cpp │ │ ├── LandmarkerSeeta.h │ │ ├── RecognizerSeeta.cpp │ │ ├── RecognizerSeeta.h │ │ ├── Resource │ │ │ └── Translations │ │ │ │ ├── PluginFaceSeeta_ar.ts │ │ │ │ ├── PluginFaceSeeta_ca.ts │ │ │ │ ├── PluginFaceSeeta_cs.ts │ │ │ │ ├── PluginFaceSeeta_da.ts │ │ │ │ ├── PluginFaceSeeta_de.ts │ │ │ │ ├── PluginFaceSeeta_el.ts │ │ │ │ ├── PluginFaceSeeta_en.ts │ │ │ │ ├── PluginFaceSeeta_en_GB.ts │ │ │ │ ├── PluginFaceSeeta_es.ts │ │ │ │ ├── PluginFaceSeeta_et.ts │ │ │ │ ├── PluginFaceSeeta_fi.ts │ │ │ │ ├── PluginFaceSeeta_fr.ts │ │ │ │ ├── PluginFaceSeeta_gd.ts │ │ │ │ ├── PluginFaceSeeta_gl.ts │ │ │ │ ├── PluginFaceSeeta_hu.ts │ │ │ │ ├── PluginFaceSeeta_it.ts │ │ │ │ ├── PluginFaceSeeta_ja.ts │ │ │ │ ├── PluginFaceSeeta_ko.ts │ │ │ │ ├── PluginFaceSeeta_nb.ts │ │ │ │ ├── PluginFaceSeeta_ne.ts │ │ │ │ ├── PluginFaceSeeta_nl.ts │ │ │ │ ├── PluginFaceSeeta_nn.ts │ │ │ │ ├── PluginFaceSeeta_oc.ts │ │ │ │ ├── PluginFaceSeeta_pl.ts │ │ │ │ ├── PluginFaceSeeta_pt_BR.ts │ │ │ │ ├── PluginFaceSeeta_pt_PT.ts │ │ │ │ ├── PluginFaceSeeta_ro.ts │ │ │ │ ├── PluginFaceSeeta_ru.ts │ │ │ │ ├── PluginFaceSeeta_sk.ts │ │ │ │ ├── PluginFaceSeeta_sl.ts │ │ │ │ ├── PluginFaceSeeta_sv.ts │ │ │ │ ├── PluginFaceSeeta_th.ts │ │ │ │ ├── PluginFaceSeeta_tr.ts │ │ │ │ ├── PluginFaceSeeta_uk.ts │ │ │ │ ├── PluginFaceSeeta_zh_CN.ts │ │ │ │ └── PluginFaceSeeta_zh_TW.ts │ │ ├── TrackerSeeta.cpp │ │ └── TrackerSeeta.h │ ├── Test │ │ ├── CMakeLists.txt │ │ ├── Test.cpp │ │ └── Test.h │ └── ncnn │ │ ├── CMakeLists.txt │ │ ├── DetectorNcnnRetina.cpp │ │ ├── DetectorNcnnRetina.h │ │ ├── FaceNcnn.cpp │ │ ├── FaceNcnn.h │ │ └── Resource │ │ └── Translations │ │ ├── PluginFaceNcnn_ar.ts │ │ ├── PluginFaceNcnn_ca.ts │ │ ├── PluginFaceNcnn_cs.ts │ │ ├── PluginFaceNcnn_da.ts │ │ ├── PluginFaceNcnn_de.ts │ │ ├── PluginFaceNcnn_el.ts │ │ ├── PluginFaceNcnn_en.ts │ │ ├── PluginFaceNcnn_en_GB.ts │ │ ├── PluginFaceNcnn_es.ts │ │ ├── PluginFaceNcnn_et.ts │ │ ├── PluginFaceNcnn_fi.ts │ │ ├── PluginFaceNcnn_fr.ts │ │ ├── PluginFaceNcnn_gd.ts │ │ ├── PluginFaceNcnn_gl.ts │ │ ├── PluginFaceNcnn_hu.ts │ │ ├── PluginFaceNcnn_it.ts │ │ ├── PluginFaceNcnn_ja.ts │ │ ├── PluginFaceNcnn_ko.ts │ │ ├── PluginFaceNcnn_nb.ts │ │ ├── PluginFaceNcnn_ne.ts │ │ ├── PluginFaceNcnn_nl.ts │ │ ├── PluginFaceNcnn_nn.ts │ │ ├── PluginFaceNcnn_oc.ts │ │ ├── PluginFaceNcnn_pl.ts │ │ ├── PluginFaceNcnn_pt_BR.ts │ │ ├── PluginFaceNcnn_pt_PT.ts │ │ ├── PluginFaceNcnn_ro.ts │ │ ├── PluginFaceNcnn_ru.ts │ │ ├── PluginFaceNcnn_sk.ts │ │ ├── PluginFaceNcnn_sl.ts │ │ ├── PluginFaceNcnn_sv.ts │ │ ├── PluginFaceNcnn_th.ts │ │ ├── PluginFaceNcnn_tr.ts │ │ ├── PluginFaceNcnn_uk.ts │ │ ├── PluginFaceNcnn_zh_CN.ts │ │ └── PluginFaceNcnn_zh_TW.ts ├── Recognizer.cpp ├── Recognizer.h ├── Resource │ └── Translations │ │ ├── FaceRecognizer_ar.ts │ │ ├── FaceRecognizer_ca.ts │ │ ├── FaceRecognizer_cs.ts │ │ ├── FaceRecognizer_da.ts │ │ ├── FaceRecognizer_de.ts │ │ ├── FaceRecognizer_el.ts │ │ ├── FaceRecognizer_en.ts │ │ ├── FaceRecognizer_en_GB.ts │ │ ├── FaceRecognizer_es.ts │ │ ├── FaceRecognizer_et.ts │ │ ├── FaceRecognizer_fi.ts │ │ ├── FaceRecognizer_fr.ts │ │ ├── FaceRecognizer_gd.ts │ │ ├── FaceRecognizer_gl.ts │ │ ├── FaceRecognizer_hu.ts │ │ ├── FaceRecognizer_it.ts │ │ ├── FaceRecognizer_ja.ts │ │ ├── FaceRecognizer_ko.ts │ │ ├── FaceRecognizer_nb.ts │ │ ├── FaceRecognizer_ne.ts │ │ ├── FaceRecognizer_nl.ts │ │ ├── FaceRecognizer_nn.ts │ │ ├── FaceRecognizer_oc.ts │ │ ├── FaceRecognizer_pl.ts │ │ ├── FaceRecognizer_pt_BR.ts │ │ ├── FaceRecognizer_pt_PT.ts │ │ ├── FaceRecognizer_ro.ts │ │ ├── FaceRecognizer_ru.ts │ │ ├── FaceRecognizer_sk.ts │ │ ├── FaceRecognizer_sl.ts │ │ ├── FaceRecognizer_sv.ts │ │ ├── FaceRecognizer_th.ts │ │ ├── FaceRecognizer_tr.ts │ │ ├── FaceRecognizer_uk.ts │ │ ├── FaceRecognizer_zh.ts │ │ ├── FaceRecognizer_zh_CN.ts │ │ ├── FaceRecognizer_zh_TW.ts │ │ ├── FaceRecognizer_zh_rCN.ts │ │ └── FaceRecognizer_zh_rTW.ts ├── Tracker.cpp ├── Tracker.h ├── database │ ├── DataRegister.cpp │ ├── DataRegister.h │ ├── Database.cpp │ ├── Database.h │ ├── TableRegister.cpp │ └── TableRegister.h └── yuv2rgb │ ├── bmp_utils.cpp │ ├── bmp_utils.h │ ├── rgb2yuv.cpp │ ├── rgb2yuv.h │ ├── yuv2rgb.cpp │ └── yuv2rgb.h ├── Update ├── update.xml └── update_android.xml ├── appveyor.yml ├── build_android.sh ├── build_debpackage.sh ├── ci ├── backgroud_echo.sh ├── build-install-tools-windows.sh ├── build-install-tools.sh ├── build.sh └── qt-installer.sh ├── cmake ├── Download.cmake ├── FindFFMPEG.cmake ├── FindLIBYUV.cmake └── Qt5CorePatches.cmake ├── debian ├── changelog ├── control ├── copyright ├── postinst ├── postrm ├── preinst ├── prerm ├── rules ├── source │ └── format └── watch ├── deploy.sh ├── docs ├── Build.md ├── Develop.md ├── Doxygen │ ├── Doxyfile.in │ ├── footer.html │ └── index.html └── Learn.md ├── etc ├── FaceRecognizer_log4qt.conf └── FaceRecognizer_logqt.ini ├── share ├── FaceRecognizer.sh └── org.Rabbit.FaceRecognizer.desktop ├── test └── test_linux.sh ├── vcpkg.json └── vcpkg └── ports └── openssl ├── install-pc-files.cmake ├── openssl.pc.in ├── portfile.cmake ├── unix ├── CMakeLists.txt ├── portfile.cmake └── remove-deps.cmake ├── usage ├── uwp ├── EnableUWPSupport.patch ├── make-openssl.bat └── portfile.cmake ├── vcpkg-cmake-wrapper.cmake.in ├── vcpkg.json └── windows ├── flags.patch └── portfile.cmake /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | 14 | - https://gitee.com/kl222/RabbitCommon/raw/master/Src/Resource/image/Contribute.png 15 | 16 | -------------------------------------------------------------------------------- /.github/workflows/codespell.yml: -------------------------------------------------------------------------------- 1 | name: Codespell 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | codespell: 9 | name: Check for spelling errors 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout Repository 13 | uses: actions/checkout@v3 14 | with: 15 | submodules: true 16 | 17 | - uses: codespell-project/actions-codespell@master 18 | with: 19 | check_filenames: true 20 | path: ${{github.workspace}} 21 | skip: "*.lua,codespell.yml,*.ts,qt-installer.sh" 22 | ignore_words_list: "nD,rabits" 23 | -------------------------------------------------------------------------------- /App/AppIcon.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "Resource/image/FaceRecognizer.ico" 2 | -------------------------------------------------------------------------------- /App/DelegateParamter.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | @brief: The delegate of CFrmPara 4 | @see: FrmPara.h 5 | FrmBroweFile.h 6 | */ 7 | 8 | #ifndef CDELEGATEPARAMTER_H 9 | #define CDELEGATEPARAMTER_H 10 | 11 | #include 12 | 13 | class CDelegateParamter : public QStyledItemDelegate 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit CDelegateParamter(QObject *parent = nullptr); 19 | enum ROLE 20 | { 21 | ROLE_PROPERTY_TYPE = Qt::UserRole, 22 | ROLE_PROPERTY_NAME, 23 | ROLE_PROPERTY_VALUE, 24 | ROLE_OBJECT 25 | }; 26 | 27 | enum TYPE 28 | { 29 | TYPE_OTHER, 30 | TYPE_ENUM, 31 | TYPE_DIRECTORY, 32 | TYPE_FILE, 33 | TYPE_STRING 34 | }; 35 | 36 | public: 37 | virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; 38 | virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; 39 | virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override; 40 | virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; 41 | }; 42 | 43 | #endif // CDELEGATEPARAMTER_H 44 | -------------------------------------------------------------------------------- /App/FrmBrowseFile.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #include "FrmBrowseFile.h" 6 | #include "ui_FrmBrowseFile.h" 7 | #include "RabbitCommonDir.h" 8 | 9 | #include 10 | 11 | CFrmBrowseFile::CFrmBrowseFile(QWidget *parent) : 12 | QWidget(parent), 13 | ui(new Ui::CFrmBrowseFile), 14 | m_bIsDirectory(false) 15 | { 16 | ui->setupUi(this); 17 | } 18 | 19 | CFrmBrowseFile::~CFrmBrowseFile() 20 | { 21 | delete ui; 22 | } 23 | 24 | int CFrmBrowseFile::setFile(const QString &szFile) 25 | { 26 | ui->leFile->setText(szFile); 27 | return 0; 28 | } 29 | 30 | QString CFrmBrowseFile::getFile() 31 | { 32 | return ui->leFile->text(); 33 | } 34 | 35 | void CFrmBrowseFile::on_pbBrowse_clicked() 36 | { 37 | QString szFile; 38 | if(m_bIsDirectory) 39 | szFile = QFileDialog::getExistingDirectory(this, 40 | tr("Open folder"), 41 | getFile()); 42 | else 43 | szFile = QFileDialog::getOpenFileName(this, tr("Open file"), getFile()); 44 | if(szFile.isEmpty()) return; 45 | setFile(szFile); 46 | } 47 | 48 | int CFrmBrowseFile::setStyleOption(const QStyleOptionViewItem *option) 49 | { 50 | m_StyleOptioins = *option; 51 | ui->leFile->setPalette(option->palette); 52 | ui->leFile->setFont(option->font); 53 | this->setPalette(option->palette); 54 | return 0; 55 | } 56 | 57 | void CFrmBrowseFile::paintEvent(QPaintEvent *event) 58 | { 59 | QPainter painter(this); 60 | QPen pen; 61 | pen.setWidth(0); 62 | pen.setColor(palette().color(QPalette::Window)); 63 | painter.setPen(pen); 64 | painter.setBrush(palette().brush(QPalette::Window)); 65 | painter.drawRect(rect()); 66 | return; 67 | } 68 | 69 | bool CFrmBrowseFile::getIsDirectory() 70 | { 71 | return m_bIsDirectory; 72 | } 73 | 74 | int CFrmBrowseFile::setIsDirectory(bool d) 75 | { 76 | m_bIsDirectory = d; 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /App/FrmBrowseFile.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef FRMBROWEFILE_H 6 | #define FRMBROWEFILE_H 7 | 8 | #include 9 | #include 10 | 11 | namespace Ui { 12 | class CFrmBrowseFile; 13 | } 14 | 15 | /** 16 | * @brief The CFrmBrowseFile class 17 | * 提供打开文件或目录。用于 CFrmPara 18 | */ 19 | class CFrmBrowseFile : public QWidget 20 | { 21 | Q_OBJECT 22 | 23 | Q_PROPERTY(QString getFile READ getFile WRITE setFile) 24 | Q_PROPERTY(bool isDirectory READ getIsDirectory WRITE setIsDirectory) 25 | 26 | public: 27 | explicit CFrmBrowseFile(QWidget *parent = nullptr); 28 | virtual ~CFrmBrowseFile() override; 29 | 30 | QString getFile(); 31 | int setFile(const QString &szFile); 32 | bool getIsDirectory(); 33 | int setIsDirectory(bool d); 34 | 35 | int setStyleOption(const QStyleOptionViewItem *option); 36 | 37 | private slots: 38 | void on_pbBrowse_clicked(); 39 | 40 | private: 41 | Ui::CFrmBrowseFile *ui; 42 | 43 | QStyleOptionViewItem m_StyleOptioins; 44 | bool m_bIsDirectory; 45 | 46 | protected: 47 | virtual void paintEvent(QPaintEvent *event) override; 48 | }; 49 | 50 | #endif // FRMBROWEFILE_H 51 | -------------------------------------------------------------------------------- /App/FrmBrowseFile.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CFrmBrowseFile 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 40 11 | 12 | 13 | 14 | 15 | 16 | 17 | 1.000000000000000 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Browse 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /App/FrmDisplay.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #include "FrmDisplay.h" 6 | #include "ui_FrmDisplay.h" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | static Q_LOGGING_CATEGORY(log, "App.Display") 13 | 14 | CFrmDisplay::CFrmDisplay(QWidget *parent) : 15 | QWidget(parent), 16 | ui(new Ui::CFrmDisplay), 17 | m_bAspectRation(true) 18 | { 19 | ui->setupUi(this); 20 | } 21 | 22 | CFrmDisplay::~CFrmDisplay() 23 | { 24 | qDebug(log) << "CFrmDisplay::~CFrmDisplay()"; 25 | delete ui; 26 | } 27 | 28 | int CFrmDisplay::slotSetAspectRatio(bool bAspectRation) 29 | { 30 | m_bAspectRation = bAspectRation; 31 | return 0; 32 | } 33 | 34 | void CFrmDisplay::slotDisplay(const QImage &image) 35 | { 36 | m_Image = image; 37 | update(); 38 | } 39 | 40 | void CFrmDisplay::paintEvent(QPaintEvent *event) 41 | { 42 | Q_UNUSED(event) 43 | if(this->isHidden()) 44 | return; 45 | if(m_Image.isNull()) return; 46 | 47 | QPainter painter(this); 48 | // 设置平滑模式 49 | painter.setRenderHint(QPainter::SmoothPixmapTransform); 50 | QRectF dstRect = rect(); 51 | if(m_bAspectRation) 52 | { 53 | //m_Image = m_Image.scaled(rect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); 54 | qreal newW = dstRect.width(); 55 | qreal newH = dstRect.height(); 56 | qreal newT = 0; 57 | qreal newL = 0; 58 | 59 | qreal rateW = static_cast(rect().width()) 60 | / static_cast(m_Image.width()); 61 | qreal rateH = static_cast(rect().height()) 62 | / static_cast(m_Image.height()); 63 | if(rateW < rateH) 64 | { 65 | newW = m_Image.width() * rateW; 66 | newH = m_Image.height() * rateW; 67 | newT = (static_cast(rect().height()) - newH) 68 | / static_cast(2); 69 | } else if(rateW > rateH) { 70 | newW = m_Image.width() * rateH; 71 | newH = m_Image.height() * rateH; 72 | newL = (static_cast(rect().width()) - newW) 73 | / static_cast(2); 74 | } 75 | dstRect = QRectF(newL, newT, newW, newH); 76 | 77 | } 78 | painter.drawImage(dstRect, m_Image); 79 | } 80 | -------------------------------------------------------------------------------- /App/FrmDisplay.h: -------------------------------------------------------------------------------- 1 | /** 2 | @brief: The form is display QImage 3 | @author: Kang Lin 4 | */ 5 | 6 | #ifndef CFRMDISPLAY_H 7 | #define CFRMDISPLAY_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Ui { 15 | class CFrmDisplay; 16 | } 17 | 18 | class CFrmDisplay 19 | : public QWidget 20 | { 21 | Q_OBJECT 22 | Q_CLASSINFO("Author", "Kang Lin ") 23 | Q_CLASSINFO("Description", "The form is display QImage") 24 | 25 | public: 26 | explicit CFrmDisplay(QWidget *parent = nullptr); 27 | virtual ~CFrmDisplay(); 28 | 29 | public Q_SLOTS: 30 | void slotDisplay(const QImage &image); 31 | int slotSetAspectRatio(bool bAspectRation = true); 32 | 33 | protected: 34 | void paintEvent(QPaintEvent *event); 35 | 36 | private: 37 | Ui::CFrmDisplay *ui; 38 | 39 | QImage m_Image; 40 | bool m_bAspectRation; 41 | }; 42 | 43 | #endif // CFRMDISPLAY_H 44 | -------------------------------------------------------------------------------- /App/FrmDisplay.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CFrmDisplay 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Display 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /App/FrmPara.h: -------------------------------------------------------------------------------- 1 | /** 2 | @brief: The form is use set parameter 3 | @author: Kang Lin 4 | */ 5 | 6 | #ifndef FRMPARA_H 7 | #define FRMPARA_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Ui { 14 | class CFrmPara; 15 | } 16 | 17 | /** 18 | * @brief The CFrmPara class 19 | * @see CDelegateParamter 20 | * CFrmBrowseFile 21 | */ 22 | class CFrmPara : public QWidget 23 | { 24 | Q_OBJECT 25 | Q_CLASSINFO("Author", "Kang Lin ") 26 | 27 | public: 28 | explicit CFrmPara(QWidget *parent = nullptr); 29 | virtual ~CFrmPara(); 30 | 31 | public Q_SLOTS: 32 | int slotUpdateParamter(QAction *pAction = nullptr); 33 | private Q_SLOTS: 34 | void slotItemChanged(QStandardItem *item); 35 | 36 | private: 37 | Ui::CFrmPara *ui; 38 | QStandardItemModel m_Model; 39 | 40 | QStandardItem *LoadObject(QObject* pObject, QStandardItem *pRoot = nullptr); 41 | }; 42 | 43 | #endif // FRMPARA_H 44 | -------------------------------------------------------------------------------- /App/FrmPara.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CFrmPara 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Set parameters 15 | 16 | 17 | 18 | :/image/Option:/image/Option 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /App/FrmRecognizerImage.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef FRMRECOGNIZERIMAGE_H 6 | #define FRMRECOGNIZERIMAGE_H 7 | 8 | #include 9 | #include "FactoryFace.h" 10 | 11 | namespace Ui { 12 | class CFrmRecognizerImage; 13 | } 14 | 15 | class CFrmRecognizerImage : public QWidget 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit CFrmRecognizerImage(QWidget *parent = nullptr); 21 | ~CFrmRecognizerImage(); 22 | 23 | private slots: 24 | void on_pbBrower_clicked(); 25 | void on_tvInformation_clicked(const QModelIndex &index); 26 | 27 | private: 28 | int RecognizeFace(QImage &image); 29 | int MarkFace(QImage &image, int nSelect = -1); 30 | int ShowUI(bool bShow = true); 31 | enum STATUS_TYPE 32 | { 33 | NORMAL, 34 | ERROR, 35 | FAIL, 36 | SUCCESS 37 | }; 38 | int SetStatusInformation(const QString &szInfo, int nRet = 0, STATUS_TYPE type = NORMAL); 39 | struct FACE_INFO 40 | { 41 | QRect face; 42 | qint64 index; 43 | CDataRegister data; 44 | }; 45 | QVector m_Info; 46 | 47 | private: 48 | Ui::CFrmRecognizerImage *ui; 49 | CFactoryFace* m_pFace; 50 | QImage m_Image; 51 | }; 52 | 53 | #endif // FRMRECOGNIZERIMAGE_H 54 | -------------------------------------------------------------------------------- /App/FrmRecognizerVideo.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef FRMRECOGNIZERVIDEO_H 6 | #define FRMRECOGNIZERVIDEO_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "FactoryFace.h" 13 | 14 | namespace Ui { 15 | class CFrmRecognizerVideo; 16 | } 17 | 18 | class CFrmRecognizerVideo : public QWidget 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | explicit CFrmRecognizerVideo(QWidget *parent = nullptr); 24 | virtual ~CFrmRecognizerVideo(); 25 | 26 | public Q_SLOTS: 27 | void slotDisplay(const QImage &image); 28 | void slotRecognized(const QMap &faceInfo); 29 | 30 | Q_SIGNALS: 31 | void sigRecognize(const QImage &image, const QVector &faces); 32 | 33 | private: 34 | enum STATUS_TYPE 35 | { 36 | NORMAL, 37 | ERROR, 38 | FAIL, 39 | SUCCESS 40 | }; 41 | int SetStatusInformation(const QString &szInfo, int nRet = 0, STATUS_TYPE type = NORMAL); 42 | 43 | private: 44 | Ui::CFrmRecognizerVideo *ui; 45 | QImage m_Image; 46 | CFactoryFace* m_pFace; 47 | QMap m_FaceInfo; 48 | QMutex m_Mutex; 49 | }; 50 | 51 | #endif // FRMRECOGNIZERVIDEO_H 52 | -------------------------------------------------------------------------------- /App/FrmRecognizerVideo.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CFrmRecognizerVideo 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Recognizer from video 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Status 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | CFrmDisplay 39 | QWidget 40 |
FrmDisplay.h
41 | 1 42 |
43 |
44 | 45 | 46 |
47 | -------------------------------------------------------------------------------- /App/FrmRegisterImage.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef FRMREGISTERIMAGE_H 6 | #define FRMREGISTERIMAGE_H 7 | 8 | #include 9 | 10 | #include "FactoryFace.h" 11 | #include "ParameterRegisterImage.h" 12 | 13 | namespace Ui { 14 | class CFrmRegisterImage; 15 | } 16 | 17 | class CFrmRegisterImage : public QWidget 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit CFrmRegisterImage(QWidget *parent = nullptr); 23 | ~CFrmRegisterImage(); 24 | 25 | Q_SIGNALS: 26 | void sigFinish(); 27 | 28 | public slots: 29 | void slotParameter(const CParameterRegisterImage ¶); 30 | 31 | private slots: 32 | void on_pbBrowser_clicked(); 33 | void on_pbRegister_clicked(); 34 | void on_pbCancel_clicked(); 35 | void on_pbReplace_clicked(); 36 | 37 | private: 38 | int ProcessImage(const QImage &image); 39 | int MarkFace(QImage &image); 40 | int ShowReplaceUI(bool bReplace = true); 41 | int Check(); 42 | enum STATUS_TYPE 43 | { 44 | NORMAL, 45 | ERROR, 46 | FAIL, 47 | SUCCESS 48 | }; 49 | int SetStatusInformation(const QString &szInfo, int nRet = 0, STATUS_TYPE type = NORMAL); 50 | 51 | private: 52 | Ui::CFrmRegisterImage *ui; 53 | 54 | CFactoryFace* m_pFace; 55 | QImage m_Image; 56 | bool m_bRegister; 57 | bool m_bReplace; 58 | }; 59 | 60 | #endif // FRMREGISTERIMAGE_H 61 | -------------------------------------------------------------------------------- /App/FrmRegisterVideo.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef FRMREGISTERVIDEO_H 6 | #define FRMREGISTERVIDEO_H 7 | 8 | #include 9 | 10 | #include "FactoryFace.h" 11 | #include "ParameterRegisterImage.h" 12 | 13 | namespace Ui { 14 | class CFrmRegisterVideo; 15 | } 16 | 17 | class CFrmRegisterVideo : public QWidget 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit CFrmRegisterVideo(QWidget *parent = nullptr); 23 | ~CFrmRegisterVideo(); 24 | 25 | Q_SIGNALS: 26 | void sigRegister(const CParameterRegisterImage &image); 27 | 28 | public Q_SLOTS: 29 | void slotDisplay(const QImage &image); 30 | 31 | private slots: 32 | void on_pbRegister_clicked(); 33 | 34 | private: 35 | enum STATUS_TYPE 36 | { 37 | NORMAL, 38 | ERROR, 39 | FAIL, 40 | SUCCESS 41 | }; 42 | int SetStatusInformation(const QString &szInfo, int nRet = 0, STATUS_TYPE type = NORMAL); 43 | int Check(); 44 | int MarkFace(QPainter &painter, const QVector &faces); 45 | int CheckFace(const QRect &box, const QRect &face); 46 | 47 | private: 48 | Ui::CFrmRegisterVideo *ui; 49 | QImage m_Image; 50 | CFactoryFace* m_pFace; 51 | QVector m_Faces; 52 | QRect m_box; 53 | int m_nImageWidth, m_nImageHeight; 54 | }; 55 | 56 | #endif // FRMREGISTERVIDEO_H 57 | -------------------------------------------------------------------------------- /App/FrmRegisterVideo.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CFrmRegisterVideo 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Register from Video 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | NO: 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Name: 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Register 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 0 53 | 0 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Status 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | CFrmDisplay 70 | QWidget 71 |
FrmDisplay.h
72 | 1 73 |
74 |
75 | 76 | 77 |
78 | -------------------------------------------------------------------------------- /App/ManageRecognizerVideo.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #include "ManageRecognizerVideo.h" 6 | #include "ui_ManageRecognizerVideo.h" 7 | #include "RecognizerThread.h" 8 | 9 | #include 10 | 11 | static Q_LOGGING_CATEGORY(log, "App.Manage.Recognizer.Video") 12 | 13 | CManageRecognizerVideo::CManageRecognizerVideo(QWidget *parent) : 14 | QWidget(parent), 15 | ui(new Ui::CManageRecognizerVideo) 16 | { 17 | ui->setupUi(this); 18 | 19 | m_pFrmRecognizerVideo = new CFrmRecognizerVideo(this); //delete it when delete this 20 | if(!m_pFrmRecognizerVideo) 21 | throw std::runtime_error("alloc memory fail"); 22 | bool check = connect(this, SIGNAL(sigCaptureFrame(const QImage&)), 23 | m_pFrmRecognizerVideo, SLOT(slotDisplay(const QImage&))); 24 | Q_ASSERT(check); 25 | check = connect(m_pFrmRecognizerVideo, 26 | SIGNAL(sigRecognize(const QImage&, const QVector &)), 27 | this, 28 | SIGNAL(sigRecognize(const QImage&, const QVector &))); 29 | Q_ASSERT(check); 30 | check = connect(this, SIGNAL(sigRecognized(const QMap &)), 31 | m_pFrmRecognizerVideo, SLOT(slotRecognized(const QMap&))); 32 | Q_ASSERT(check); 33 | 34 | m_pThread = new CRecognizerThread(this); 35 | m_pThread->start(); 36 | } 37 | 38 | CManageRecognizerVideo::~CManageRecognizerVideo() 39 | { 40 | qDebug(log) << "CManageRecognizerVideo::~CManageRecognizerVideo()"; 41 | m_pThread->exit(); 42 | delete ui; 43 | } 44 | 45 | void CManageRecognizerVideo::slotRecognized(const QImage &image) 46 | { 47 | Q_UNUSED(image) 48 | m_pFrmRecognizerVideo->hide(); 49 | } 50 | 51 | void CManageRecognizerVideo::slotRecognizerFinish() 52 | { 53 | m_pFrmRecognizerVideo->show(); 54 | m_pFrmRecognizerVideo->resize(this->size()); 55 | } 56 | 57 | void CManageRecognizerVideo::resizeEvent(QResizeEvent *event) 58 | { 59 | if(!m_pFrmRecognizerVideo->isHidden()) 60 | m_pFrmRecognizerVideo->resize(event->size()); 61 | } 62 | -------------------------------------------------------------------------------- /App/ManageRecognizerVideo.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef MANAGERECOGNIZERVIDEO_H 6 | #define MANAGERECOGNIZERVIDEO_H 7 | 8 | #include 9 | #include 10 | 11 | #include "FrmRecognizerVideo.h" 12 | 13 | class CRecognizerThread; 14 | 15 | namespace Ui { 16 | class CManageRecognizerVideo; 17 | } 18 | 19 | class CManageRecognizerVideo : public QWidget 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | explicit CManageRecognizerVideo(QWidget *parent = nullptr); 25 | virtual ~CManageRecognizerVideo() override; 26 | 27 | public Q_SLOTS: 28 | void slotRecognized(const QImage &image); 29 | void slotRecognizerFinish(); 30 | 31 | Q_SIGNALS: 32 | void sigCaptureFrame(const QImage &image); 33 | void sigRecognize(const QImage &image, const QVector &faces); 34 | void sigRecognized(const QMap &faceInfo); 35 | 36 | private: 37 | Ui::CManageRecognizerVideo *ui; 38 | CFrmRecognizerVideo *m_pFrmRecognizerVideo; 39 | CRecognizerThread *m_pThread; 40 | 41 | protected: 42 | virtual void resizeEvent(QResizeEvent *event) override; 43 | }; 44 | 45 | #endif // MANAGERECOGNIZERVIDEO_H 46 | -------------------------------------------------------------------------------- /App/ManageRecognizerVideo.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CManageRecognizerVideo 6 | 7 | 8 | 9 | 0 10 | 0 11 | 400 12 | 300 13 | 14 | 15 | 16 | Form 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /App/ManageRegisterVideo.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #include "ManageRegisterVideo.h" 6 | #include 7 | #include 8 | 9 | static Q_LOGGING_CATEGORY(log, "App.Manage.Register.Video") 10 | 11 | CManageRegisterVideo::CManageRegisterVideo(QWidget *parent) : QWidget(parent) 12 | { 13 | setWindowTitle(tr("Register from video")); 14 | 15 | m_RegisterVideo = QSharedPointer(new CFrmRegisterVideo(this)); 16 | m_RegisterImage = QSharedPointer(new CFrmRegisterImage(this)); 17 | if(!(m_RegisterImage && m_RegisterVideo)) 18 | throw std::runtime_error("alloce memory fail"); 19 | 20 | m_RegisterVideo->move(0, 0); 21 | m_RegisterImage->move(0, 0); 22 | m_RegisterImage->hide(); 23 | 24 | bool check = connect(this, SIGNAL(sigCaptureFrame(const QImage &)), 25 | m_RegisterVideo.data(), SLOT(slotDisplay(const QImage &))); 26 | Q_ASSERT(check); 27 | check = connect(m_RegisterVideo.data(), SIGNAL(sigRegister(const CParameterRegisterImage &)), 28 | this, SLOT(slotRigister(const CParameterRegisterImage &))); 29 | Q_ASSERT(check); 30 | check = connect(m_RegisterImage.data(), SIGNAL(sigFinish()), 31 | this, SLOT(slotRegisterFinish())); 32 | Q_ASSERT(check); 33 | } 34 | 35 | void CManageRegisterVideo::resizeEvent(QResizeEvent *event) 36 | { 37 | if(!m_RegisterImage->isHidden()) 38 | m_RegisterImage->resize(event->size()); 39 | 40 | if(!m_RegisterVideo->isHidden()) 41 | m_RegisterVideo->resize(event->size()); 42 | } 43 | 44 | void CManageRegisterVideo::slotRigister(const CParameterRegisterImage ¶) 45 | { 46 | m_RegisterImage->slotParameter(para); 47 | m_RegisterImage->show(); 48 | m_RegisterImage->resize(this->size()); 49 | m_RegisterVideo->hide(); 50 | } 51 | 52 | void CManageRegisterVideo::slotRegisterFinish() 53 | { 54 | m_RegisterImage->hide(); 55 | m_RegisterVideo->show(); 56 | m_RegisterVideo->resize(size()); 57 | } 58 | -------------------------------------------------------------------------------- /App/ManageRegisterVideo.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef CMANAGEREGISTERVIDEO_H 6 | #define CMANAGEREGISTERVIDEO_H 7 | 8 | #include 9 | #include 10 | 11 | #include "FrmRegisterVideo.h" 12 | #include "FrmRegisterImage.h" 13 | #include "ParameterRegisterImage.h" 14 | 15 | class CManageRegisterVideo : public QWidget 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit CManageRegisterVideo(QWidget *parent = nullptr); 21 | 22 | public Q_SLOTS: 23 | void slotRigister(const CParameterRegisterImage ¶); 24 | void slotRegisterFinish(); 25 | 26 | Q_SIGNALS: 27 | void sigCaptureFrame(const QImage &image); 28 | 29 | private: 30 | QSharedPointer m_RegisterVideo; 31 | QSharedPointer m_RegisterImage; 32 | 33 | protected: 34 | virtual void resizeEvent(QResizeEvent *event) override; 35 | }; 36 | 37 | #endif // CMANAGEREGISTERVIDEO_H 38 | -------------------------------------------------------------------------------- /App/ParameterRegisterImage.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #include "ParameterRegisterImage.h" 6 | #include 7 | 8 | static Q_LOGGING_CATEGORY(log, "App.Manage.Recognizer.Image") 9 | CParameterRegisterImage::CParameterRegisterImage(QObject *parent) : QObject(parent) 10 | {} 11 | 12 | CParameterRegisterImage::CParameterRegisterImage(const CParameterRegisterImage &other) 13 | { 14 | m_No = other.m_No; 15 | m_szName = other.m_szName; 16 | m_Image = other.m_Image; 17 | } 18 | 19 | int CParameterRegisterImage::SetNo(qint64 no) 20 | { 21 | m_No = no; 22 | return 0; 23 | } 24 | 25 | qint64 CParameterRegisterImage::GetNo() 26 | { 27 | return m_No; 28 | } 29 | 30 | int CParameterRegisterImage::SetName(const QString &szName) 31 | { 32 | m_szName = szName; 33 | return 0; 34 | } 35 | 36 | QString CParameterRegisterImage::GetName() 37 | { 38 | return m_szName; 39 | } 40 | 41 | int CParameterRegisterImage::SetImage(const QImage &image) 42 | { 43 | m_Image = image; 44 | return 0; 45 | } 46 | 47 | QImage CParameterRegisterImage::GetImage() 48 | { 49 | return m_Image; 50 | } 51 | -------------------------------------------------------------------------------- /App/ParameterRegisterImage.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef CPARAMETERREGISTERIMAGE_H 6 | #define CPARAMETERREGISTERIMAGE_H 7 | 8 | #include 9 | #include 10 | 11 | class CParameterRegisterImage : public QObject 12 | { 13 | Q_OBJECT 14 | 15 | Q_PROPERTY(qint64 no READ GetNo WRITE SetNo) 16 | Q_PROPERTY(QString name READ GetName WRITE SetName) 17 | Q_PROPERTY(QImage image READ GetImage WRITE SetImage) 18 | 19 | public: 20 | explicit CParameterRegisterImage(QObject *parent = nullptr); 21 | CParameterRegisterImage(const CParameterRegisterImage &other); 22 | 23 | int SetNo(qint64 no); 24 | qint64 GetNo(); 25 | 26 | int SetName(const QString &szName); 27 | QString GetName(); 28 | 29 | int SetImage(const QImage &image); 30 | QImage GetImage(); 31 | 32 | private: 33 | qint64 m_No; 34 | QString m_szName; 35 | QImage m_Image; 36 | }; 37 | 38 | #endif // CPARAMETERREGISTERIMAGE_H 39 | -------------------------------------------------------------------------------- /App/RecognizerThread.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #include "RecognizerThread.h" 6 | #include "RecognizerVideo.h" 7 | 8 | #include 9 | 10 | static Q_LOGGING_CATEGORY(log, "App.Thread") 11 | 12 | CRecognizerThread::CRecognizerThread(CManageRecognizerVideo *parent) : QThread() 13 | { 14 | m_pManageRecognizerVideo = dynamic_cast(parent); 15 | } 16 | 17 | CRecognizerThread::~CRecognizerThread() 18 | { 19 | qDebug(log) << "CRecognizerThread::~CRecognizerThread"; 20 | } 21 | 22 | void CRecognizerThread::run() 23 | { 24 | qDebug(log) << "CRecognizerThread::run():" << QThread::currentThreadId(); 25 | CRecognizerVideo recognizer; 26 | bool check = connect(m_pManageRecognizerVideo, SIGNAL(sigRecognize(const QImage&, const QVector &)), 27 | &recognizer, SLOT(slotRecognize(const QImage &, const QVector &))); 28 | Q_ASSERT(check); 29 | check = connect(&recognizer, SIGNAL(sigRecognized(const QMap &)), 30 | m_pManageRecognizerVideo, SIGNAL(sigRecognized(const QMap &))); 31 | Q_ASSERT(check); 32 | 33 | this->exec(); 34 | } 35 | -------------------------------------------------------------------------------- /App/RecognizerThread.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef CRECOGNIZERTHREAD_H 6 | #define CRECOGNIZERTHREAD_H 7 | 8 | #pragma once 9 | #include 10 | #include "ManageRecognizerVideo.h" 11 | 12 | class CRecognizerThread : public QThread 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit CRecognizerThread(CManageRecognizerVideo *parent = nullptr); 18 | virtual ~CRecognizerThread() override; 19 | 20 | public Q_SLOTS: 21 | 22 | protected: 23 | virtual void run() override; 24 | 25 | private: 26 | CManageRecognizerVideo *m_pManageRecognizerVideo; 27 | }; 28 | 29 | #endif // CRECOGNIZERTHREAD_H 30 | -------------------------------------------------------------------------------- /App/RecognizerVideo.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #include "RecognizerVideo.h" 6 | #include "Performance.h" 7 | 8 | #include 9 | #include 10 | 11 | static Q_LOGGING_CATEGORY(log, "App.Recognizer.Video") 12 | 13 | static int gIdQMapIntQString = qRegisterMetaType >(); 14 | CRecognizerVideo::CRecognizerVideo(QObject *parent) : QObject(parent) 15 | {} 16 | 17 | void CRecognizerVideo::slotRecognize(const QImage &image, const QVector &faces) 18 | { 19 | if(image.isNull() || faces.isEmpty()) return; 20 | 21 | CFactoryFace *pFace = CFactoryFace::Instance(); 22 | if(!pFace->bIsValid()) return; 23 | 24 | PERFORMANCE(CRecognizerVideo) 25 | QMap faceInfo; 26 | foreach (auto face, faces) { 27 | QVector points; 28 | pFace->GetLandmarker()->Mark(image, face.rect, points); 29 | PERFORMANCE_ADD_TIME(CRecognizerVideo, 30 | "Mark points:" + QString::number(points.size())) 31 | if(points.isEmpty()) 32 | { 33 | qCritical(log) << "points is empty"; 34 | continue; 35 | } 36 | qint64 index = pFace->GetRecognizer()->Query(image, face.rect); 37 | PERFORMANCE_ADD_TIME(CRecognizerVideo, "Query") 38 | if(-1 == index) 39 | { 40 | qCritical(log) << "pid[" << face.pid << "] don't query"; 41 | continue; 42 | } 43 | CDataRegister data; 44 | int nRet = pFace->GetDatabase()->GetTableRegister()->GetRegisterInfo(index, &data); 45 | PERFORMANCE_ADD_TIME(CRecognizerVideo, "GetRegisterInfo") 46 | if(nRet) 47 | continue; 48 | faceInfo.insert(face.pid, data.getName()); 49 | } 50 | if(!faceInfo.isEmpty()) 51 | { 52 | emit sigRecognized(faceInfo); 53 | //qDebug() << "emit sigRecognized(faceInfo); end"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /App/RecognizerVideo.h: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | #ifndef CRECOGNIZERVIDEO_H 6 | #define CRECOGNIZERVIDEO_H 7 | 8 | #pragma once 9 | #include 10 | #include "FactoryFace.h" 11 | 12 | class CRecognizerVideo : public QObject 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit CRecognizerVideo(QObject *parent = nullptr); 18 | 19 | Q_SIGNALS: 20 | void sigRecognized(const QMap &faceInfo); 21 | 22 | public slots: 23 | void slotRecognize(const QImage &image, const QVector &faces); 24 | }; 25 | 26 | #endif // CRECOGNIZERVIDEO_H 27 | -------------------------------------------------------------------------------- /App/Resource/Resource.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | image/FaceRecognizer.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-black/index.theme: -------------------------------------------------------------------------------- 1 | 2 | [Icon Theme] 3 | Name=black 4 | Comment=black 5 | Inherits=breeze 6 | Directories=svg, png, ico 7 | 8 | [svg] 9 | Size=200 10 | MinSize=16 11 | ManSize=256 12 | Type=Scalable 13 | 14 | [png] 15 | Size=200 16 | MinSize=16 17 | ManSize=256 18 | Type=Scalable 19 | 20 | [ico] 21 | Size=200 22 | MinSize=16 23 | ManSize=256 24 | Type=Scalable 25 | 26 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-black/svg/image.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-black/svg/register.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-black/svg/video-file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-black/svg/video-folder.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-green/index.theme: -------------------------------------------------------------------------------- 1 | 2 | [Icon Theme] 3 | Name=black 4 | Comment=black 5 | Inherits=breeze 6 | Directories=svg, png, ico 7 | 8 | [svg] 9 | Size=200 10 | MinSize=16 11 | ManSize=256 12 | Type=Scalable 13 | 14 | [png] 15 | Size=200 16 | MinSize=16 17 | ManSize=256 18 | Type=Scalable 19 | 20 | [ico] 21 | Size=200 22 | MinSize=16 23 | ManSize=256 24 | Type=Scalable 25 | 26 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-green/svg/image.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-green/svg/register.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-green/svg/video-file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-green/svg/video-folder.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-red/index.theme: -------------------------------------------------------------------------------- 1 | 2 | [Icon Theme] 3 | Name=black 4 | Comment=black 5 | Inherits=breeze 6 | Directories=svg, png, ico 7 | 8 | [svg] 9 | Size=200 10 | MinSize=16 11 | ManSize=256 12 | Type=Scalable 13 | 14 | [png] 15 | Size=200 16 | MinSize=16 17 | ManSize=256 18 | Type=Scalable 19 | 20 | [ico] 21 | Size=200 22 | MinSize=16 23 | ManSize=256 24 | Type=Scalable 25 | 26 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-red/svg/image.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-red/svg/register.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-red/svg/video-file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-red/svg/video-folder.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-white/index.theme: -------------------------------------------------------------------------------- 1 | 2 | [Icon Theme] 3 | Name=black 4 | Comment=black 5 | Inherits=breeze 6 | Directories=svg, png, ico 7 | 8 | [svg] 9 | Size=200 10 | MinSize=16 11 | ManSize=256 12 | Type=Scalable 13 | 14 | [png] 15 | Size=200 16 | MinSize=16 17 | ManSize=256 18 | Type=Scalable 19 | 20 | [ico] 21 | Size=200 22 | MinSize=16 23 | ManSize=256 24 | Type=Scalable 25 | 26 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-white/svg/image.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-white/svg/register.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-white/svg/video-file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/icons/rabbit-white/svg/video-folder.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /App/Resource/image/FaceRecognizer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KangLin/FaceRecognizer/cae0c74d1636ddfac4e0141f899528944d07b46d/App/Resource/image/FaceRecognizer.ico -------------------------------------------------------------------------------- /App/Resource/image/FaceRecognizer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KangLin/FaceRecognizer/cae0c74d1636ddfac4e0141f899528944d07b46d/App/Resource/image/FaceRecognizer.png -------------------------------------------------------------------------------- /App/android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KangLin/FaceRecognizer/cae0c74d1636ddfac4e0141f899528944d07b46d/App/android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /App/android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KangLin/FaceRecognizer/cae0c74d1636ddfac4e0141f899528944d07b46d/App/android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /App/android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KangLin/FaceRecognizer/cae0c74d1636ddfac4e0141f899528944d07b46d/App/android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /App/android/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 人脸识别 5 | 6 | 7 | -------------------------------------------------------------------------------- /App/android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Face recognizer 5 | 6 | 7 | -------------------------------------------------------------------------------- /App/main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | @author: Kang Lin 3 | */ 4 | 5 | 6 | #ifdef RABBITCOMMON 7 | #include "RabbitCommonTools.h" 8 | #include "RabbitCommonDir.h" 9 | #include "FrmUpdater/FrmUpdater.h" 10 | #endif 11 | 12 | #include "MainWindow.h" 13 | 14 | #include 15 | 16 | #include 17 | static Q_LOGGING_CATEGORY(log, "App.main") 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | QApplication app(argc, argv); 22 | app.setApplicationVersion(FaceRecognizer_VERSION); 23 | app.setApplicationName("FaceRecognizer"); 24 | 25 | #ifdef RABBITCOMMON 26 | RabbitCommon::CTools::Instance()->Init(); 27 | RabbitCommon::CTools::Instance()->InstallTranslator("FaceRecognizerApp"); 28 | #endif 29 | 30 | app.setApplicationDisplayName(QObject::tr("Face recognizer")); 31 | 32 | #ifdef RABBITCOMMON 33 | CFrmUpdater *pUpdate = new CFrmUpdater(); 34 | pUpdate->SetTitle(QImage(":/image/FaceRecognizer")); 35 | if(app.arguments().length() > 1) { 36 | pUpdate->GenerateUpdateJson(); 37 | pUpdate->GenerateUpdateXml(); 38 | return 0; 39 | } 40 | #endif 41 | 42 | QFile f(":/qss/black.qss"); 43 | if(f.open(QFile::ReadOnly)) 44 | { 45 | QString szStyle = f.readAll(); 46 | qDebug(log) << "Style:" << szStyle; 47 | qApp->setStyleSheet(szStyle); 48 | f.close(); 49 | } 50 | 51 | app.addLibraryPath(RabbitCommon::CDir::Instance()->GetDirPlugins()); 52 | 53 | MainWindow w; 54 | 55 | #if defined (Q_OS_ANDROID) 56 | w.showMaximized(); 57 | #else 58 | w.show(); 59 | #endif 60 | 61 | int nRet = app.exec(); 62 | 63 | return nRet; 64 | } 65 | -------------------------------------------------------------------------------- /Authors.md: -------------------------------------------------------------------------------- 1 | Authors: 2 | 3 | - KangLin(kl222@126.com) 4 | 5 | The third project: 6 | 7 | - [Qt (LGPL v2.1)](http://qt.io/) 8 | - [opencv](https://github.com/opencv/opencv) 9 | - [dlib](https://github.com/davisking/dlib) 10 | - [OpenFace](https://github.com/TadasBaltrusaitis/OpenFace) 11 | - [SeetaFace2](https://github.com/seetafaceengine/SeetaFace2) 12 | 13 | -------------------------------------------------------------------------------- /Authors_zh_CN.md: -------------------------------------------------------------------------------- 1 | 作者: 2 | 3 | - 康林(kl222@126.com) 4 | 5 | 第三方库: 6 | 7 | - [Qt (LGPL v2.1)](http://qt.io/) 8 | - [opencv](https://github.com/opencv/opencv) 9 | - [dlib](https://github.com/davisking/dlib) 10 | - [OpenFace](https://github.com/TadasBaltrusaitis/OpenFace) 11 | - [SeetaFace2](https://github.com/seetafaceengine/SeetaFace2) 12 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | - v0.0.5 2 | - Add set parameters in main windows dock 3 | - Modify Detect interface 4 | - Delete parameter interface 5 | - Use qt plugs manage ai libraries 6 | - Add libfacedection 7 | - Add ncnn face 8 | - FIX: divide by 0 crash. Affects all previous releases. 9 | See RabbitCommon: 7ed300a206d8a36c30003b6c19ad181682d0ff5f 10 | - FFmpeg: update API avpicture_* to av_image_* 11 | - Support Qt6 12 | - Use [RabbitCommon v2.2.0](https://github.com/KangLin/RabbitCommon/releases/tag/v2.2.0) 13 | - Copy ChangeLog etc files to ${CMAKE_INSTALL_DOCDIR} 14 | 15 | - v0.0.4 16 | - Add opencv face 17 | - Add opencv dnn face detect 18 | - Add opencv face face detect 19 | - Add opencv facde landmark 20 | - Modify face interface 21 | - Modify CLandmarker class 22 | - Modify CRecognizer class 23 | - Modify CFactoryFace class 24 | - Automatically generate android binary(APK) distributions under CI 25 | - UI 26 | - Add log dialog 27 | - Add select AI libraries menu 28 | - v0.0.3 29 | - Add database 30 | - Add register from image 31 | - Add recognizer from image 32 | - Add register from video 33 | - Add recognizer from video 34 | - Use default qt in ubuntu to ci 35 | - Automatically generate binary distributions under CI 36 | 37 | - v0.0.2 38 | - Register and recognizer face from video file 39 | - Add format convert 40 | - Add application icon 41 | 42 | - v0.0.1 43 | - Face recognizer 44 | - Face register 45 | - Display carmera 46 | -------------------------------------------------------------------------------- /ChangeLog_zh_CN.md: -------------------------------------------------------------------------------- 1 | - v0.0.5 2 | - 在主窗口中增加设置属性停泊条 3 | - 修改接口,增加参数属性 4 | - 删除参数接口 5 | - 用 QT 插件方式管理 AI 库 6 | - 增加 libfacedection 实现人脸接口 7 | - 增加 ncnn 实现人脸接口 8 | - 修复除 0 引起的崩溃。影响前面所有发行版本。此错误是 RabbitCommon 引起的。 9 | 详见:RabbitCommon: 7ed300a206d8a36c30003b6c19ad181682d0ff5f 10 | - FFmpeg: 兼容 API avpicture_* to av_image_* 11 | - 支持 Qt6 12 | - 使用 [RabbitCommon v2.2.0](https://github.com/KangLin/RabbitCommon/releases/tag/v2.2.0) 13 | - 复制日志等文件到 ${CMAKE_INSTALL_DOCDIR} 14 | 15 | - v0.0.4 16 | - 增加 opencv 实现人脸接口 17 | - 增加 opencv dnn 人脸检测 18 | - 增加 opencv face 人脸检测 19 | - 增加 opencv facde 特征点检测 20 | - 修改人脸接口 21 | - 修改 CLandmarker 类 22 | - 修改 CRecognizer 类 23 | - 修改 CFactoryFace 类 24 | - 从自动化编译中分发 android 二进制包 25 | - 修改界面 26 | - 增加日志对话框 27 | - 增加AI库选择菜单 28 | 29 | - v0.0.3 30 | - 增加数据库 31 | - 增加从图像注册 32 | - 增加从视频注册 33 | - 增加从图像识别 34 | - 增加从视频识别 35 | - Ubuntu 下使用系统自带 qt 自动化编译 36 | - CI 下自动生成二进制分发包 37 | 38 | - v0.0.2 39 | - 从视频文件中注册与识别人脸 40 | - 增加视频格式转换 41 | - 增加应用图标 42 | 43 | - v0.0.1 44 | - 人脸注册 45 | - 人脸识别 46 | - 显示摄像头 47 | -------------------------------------------------------------------------------- /Donate.md: -------------------------------------------------------------------------------- 1 | ## 感谢下列捐赠者对本项目的支持 2 | 3 | 捐赠者|捐赠金额 4 | -----|------- 5 | 秦振竖|10 6 | 谢超|200 7 | 邱鹏|30 8 | *旭|20 9 | M*x|20 10 | XXX|99.9 11 | 杨维|66 12 | 刘波|200 13 | -------------------------------------------------------------------------------- /Install/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Use to install appimage in linux 4 | # $1: install or remove 5 | # $2: run 6 | 7 | case "$1" in 8 | remove) 9 | echo "remove ..." 10 | rm -f /usr/share/applications/FaceRecognizer.desktop 11 | rm -f ~/.config/autostart/FaceRecognizer.desktop 12 | rm -f /usr/share/pixmaps/FaceRecognizer.png 13 | ;; 14 | 15 | install|*) 16 | echo "install ..." 17 | # Install desktop 18 | if [ -f /usr/share/applications/FaceRecognizer.desktop ]; then 19 | rm /usr/share/applications/FaceRecognizer.desktop 20 | fi 21 | ln -s `pwd`/share/applications/FaceRecognizer.desktop /usr/share/applications/FaceRecognizer.desktop 22 | 23 | # Install auto run on boot 24 | if [ ! -d ~/.config/autostart ]; then 25 | mkdir -p ~/.config/autostart 26 | chmod a+wr ~/.config/autostart 27 | fi 28 | if [ -f ~/.config/autostart/FaceRecognizer.desktop ]; then 29 | rm ~/.config/autostart/FaceRecognizer.desktop 30 | fi 31 | ln -s `pwd`/share/applications/FaceRecognizer.desktop ~/.config/autostart/FaceRecognizer.desktop 32 | 33 | # Reset exec to desktop 34 | sed -i "s/Exec=.*//g" `pwd`/share/applications/FaceRecognizer.desktop 35 | echo "Exec=`pwd`/FaceRecognizer-x86_64.AppImage" >> `pwd`/share/applications/FaceRecognizer.desktop 36 | 37 | # Install applications icon 38 | if [ -f /usr/share/pixmaps/FaceRecognizer.png ]; then 39 | rm /usr/share/pixmaps/FaceRecognizer.png 40 | fi 41 | if [ ! -d /usr/share/pixmaps ]; then 42 | mkdir -p /usr/share/pixmaps 43 | fi 44 | ln -s `pwd`/share/pixmaps/FaceRecognizer.png /usr/share/pixmaps/FaceRecognizer.png 45 | 46 | # Whether run after install 47 | if [ "$2" = "run" ]; then 48 | ./FaceRecognizer-x86_64.AppImage 49 | fi 50 | ;; 51 | esac 52 | -------------------------------------------------------------------------------- /Resource/ResourceSql.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | db/database.sql 4 | 5 | 6 | -------------------------------------------------------------------------------- /Resource/db/database.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `Register` ( 2 | `idx` INTEGER NOT NULL UNIQUE, -- Face feature index 3 | `name` TEXT, -- Name 4 | `no` INTEGER NOT NULL UNIQUE, -- Work number 5 | PRIMARY KEY(`idx`,`no`) 6 | ); 7 | -------------------------------------------------------------------------------- /Src/ConverFormat.cpp: -------------------------------------------------------------------------------- 1 | #include "ConverFormat.h" 2 | 3 | CConverFormat::CConverFormat(QObject *parent) : QObject(parent) 4 | {} 5 | 6 | int CConverFormat::Initialize() 7 | { 8 | return 0; 9 | } 10 | 11 | int CConverFormat::Clean() 12 | { 13 | return 0; 14 | } 15 | 16 | QString CConverFormat::getName() 17 | { 18 | return this->metaObject()->className(); 19 | } 20 | 21 | QString CConverFormat::Detail() 22 | { 23 | return QString(); 24 | } 25 | -------------------------------------------------------------------------------- /Src/ConverFormat.h: -------------------------------------------------------------------------------- 1 | #ifndef CCONVERFORMAT_H 2 | #define CCONVERFORMAT_H 3 | 4 | #include 5 | #include 6 | #include "facerecognizer_export.h" 7 | 8 | /*! 9 | * \~english 10 | * \defgroup API_CONVER_FORMAT Format conversion interface 11 | * 12 | * \~chinese 13 | * \defgroup API_CONVER_FORMAT 格式转换接口 14 | * \~ 15 | * \ingroup API_INTERNAL 16 | */ 17 | 18 | /** 19 | * \~english Format conversion plug-in interface. 20 | * It converts the format of the image, which is implemented by the plugin. 21 | * 22 | * \~chinese 23 | * \brief 格式转换插件接口。它转换图像的格式,由插件实现。 24 | * \~ 25 | * \ingroup API_INTERNAL 26 | */ 27 | class FACERECOGNIZER_EXPORT CConverFormat : public QObject 28 | { 29 | Q_OBJECT 30 | Q_PROPERTY(QString name READ getName) 31 | 32 | public: 33 | explicit CConverFormat(QObject *parent = nullptr); 34 | 35 | virtual QImage onConverFormatToRGB888(const QVideoFrame &frame) = 0; 36 | 37 | virtual int Initialize(); 38 | virtual int Clean(); 39 | 40 | virtual QString getName(); 41 | virtual QString Detail(); 42 | }; 43 | 44 | #define CONVER_FORMAT_IID "KangLinStudio.Rabbit.FaceRecognizer.Plugs.ImageTool.ConverFormat" 45 | Q_DECLARE_INTERFACE(CConverFormat, CONVER_FORMAT_IID) 46 | #endif // CCONVERFORMAT_H 47 | -------------------------------------------------------------------------------- /Src/Detector.cpp: -------------------------------------------------------------------------------- 1 | #include "Detector.h" 2 | 3 | CDetector::CDetector(CFace *pFace, QObject *parent) : CFaceBase(parent), 4 | m_pFace(pFace) 5 | {} 6 | 7 | CDetector::~CDetector() 8 | {} 9 | -------------------------------------------------------------------------------- /Src/Detector.h: -------------------------------------------------------------------------------- 1 | #ifndef CDETECTOR_H_KL_2019_10_21 2 | #define CDETECTOR_H_KL_2019_10_21 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "facerecognizer_export.h" 14 | #include "FaceBase.h" 15 | 16 | class CFace; 17 | /*! 18 | * \~english Face detector 19 | * 20 | * \~chinese 人脸检测接口类 21 | * 22 | * \~ 23 | * \ingroup API_FACE 24 | */ 25 | class FACERECOGNIZER_EXPORT CDetector : public CFaceBase 26 | { 27 | Q_OBJECT 28 | Q_CLASSINFO("Description", "Detector interface") 29 | 30 | public: 31 | CDetector(CFace* pFace = nullptr, QObject *parent = nullptr); 32 | virtual ~CDetector(); 33 | 34 | /** 35 | * @brief Detect 36 | * @param image: 37 | * @param faces 38 | * @return 39 | */ 40 | virtual int Detect(const QImage &image, QVector &faces) = 0; 41 | 42 | protected: 43 | CFace* m_pFace; 44 | }; 45 | 46 | #endif // CDETECTOR_H_KL_2019_10_21 47 | -------------------------------------------------------------------------------- /Src/Face.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CFACE_H 3 | #define CFACE_H 4 | 5 | #include 6 | #include 7 | 8 | #include "facerecognizer_export.h" 9 | 10 | #include "Detector.h" 11 | #include "Tracker.h" 12 | #include "Landmarker.h" 13 | #include "Recognizer.h" 14 | #include "FaceTools.h" 15 | #include "database/Database.h" 16 | 17 | /*! 18 | * \~english Face recognition plug-in interface. Implemented by plugins. 19 | * 20 | * \~chinese 21 | * \brief 人脸识别插件接口。由插件实现。 22 | * 23 | * \~ 24 | * \see CFactoryFace 25 | * \ingroup API_INTERNAL 26 | */ 27 | class FACERECOGNIZER_EXPORT CFace : public QObject 28 | { 29 | Q_OBJECT 30 | Q_CLASSINFO("Author", "Kang Lin ") 31 | 32 | Q_PROPERTY(QString name READ GetName) 33 | Q_PROPERTY(QString descritp READ GetDescript) 34 | Q_PROPERTY(int level READ GetLevel) 35 | 36 | public: 37 | explicit CFace(QObject *parent = nullptr); 38 | virtual ~CFace(); 39 | 40 | virtual int Initialize(); 41 | virtual int Clean(); 42 | virtual QString GetName(); 43 | virtual QString GetDescript(); 44 | enum LEVEL 45 | { 46 | HEIGHT = 1, 47 | NORMAL = 0, 48 | LOWER = -1 49 | }; 50 | virtual int GetLevel(); 51 | 52 | bool IsValid(); 53 | 54 | virtual CDetector* GetDector(); 55 | virtual CTracker* GetTracker(); 56 | virtual CLandmarker* GetLandmarker(); 57 | virtual CRecognizer* GetRecognizer(); 58 | virtual CFaceTools* GetFaceTools(); 59 | virtual CDatabase* GetDatabase(); 60 | 61 | virtual const QString Detail() const; 62 | 63 | protected: 64 | CDetector* m_pDetector; 65 | CTracker* m_pTracker; 66 | CLandmarker* m_pLandmarker; 67 | CRecognizer* m_pRecognizer; 68 | CFaceTools* m_pFaceTools; 69 | 70 | private: 71 | CDatabase* m_pDatabase; 72 | }; 73 | 74 | #define FACE_IID "KangLinStudio.Rabbit.FaceRecognizer.Plugs.Interface.CFace" 75 | Q_DECLARE_INTERFACE(CFace, FACE_IID) 76 | 77 | #endif // CFACE_H 78 | -------------------------------------------------------------------------------- /Src/FaceBase.cpp: -------------------------------------------------------------------------------- 1 | #include "FaceBase.h" 2 | 3 | #include "RabbitCommonDir.h" 4 | #include 5 | 6 | static Q_LOGGING_CATEGORY(log, "Face.Base") 7 | 8 | CFaceBase::CFaceBase(QObject *parent) : QObject(parent), 9 | m_Device(CPU) 10 | { 11 | m_szModelPath = RabbitCommon::CDir::Instance()->GetDirData(false) 12 | + QDir::separator() + "model"; 13 | qDebug(log) << "szPath:" << m_szModelPath; 14 | #if defined(Q_OS_ANDROID) 15 | QDir d; 16 | if(!d.exists(m_szModelPath)) 17 | { 18 | d.mkpath(m_szModelPath); 19 | RabbitCommon::CDir::CopyDirectory( 20 | RabbitCommon::CDir::Instance()->GetDirData(true) 21 | + QDir::separator() + "model", 22 | m_szModelPath); 23 | } 24 | #endif 25 | } 26 | 27 | int CFaceBase::setModelPath(const QString &szPath) 28 | { 29 | if(m_szModelPath == szPath) 30 | return 0; 31 | m_szModelPath = szPath; 32 | return UpdateParameter(); 33 | } 34 | 35 | QString CFaceBase::getModelPath() 36 | { 37 | return m_szModelPath; 38 | } 39 | 40 | CFaceBase::DEVICE CFaceBase::getDevice() 41 | { 42 | return m_Device; 43 | } 44 | 45 | int CFaceBase::setDevice(DEVICE device) 46 | { 47 | if(m_Device == device) 48 | return 0; 49 | m_Device = device; 50 | return UpdateParameter(); 51 | } 52 | -------------------------------------------------------------------------------- /Src/FaceBase.h: -------------------------------------------------------------------------------- 1 | #ifndef CFACEBASE_H 2 | #define CFACEBASE_H 3 | 4 | #include 5 | #include "facerecognizer_export.h" 6 | 7 | /*! 8 | * \~english API_FACE Face interface 9 | * 10 | * \~chinese 11 | * \defgroup API_FACE 人脸识别接口 12 | * 13 | * \~ 14 | * \ingroup API 15 | */ 16 | 17 | /** 18 | * \~english the class of face interface. 19 | * it is the base class of all face interface. 20 | * 21 | * \~chinese 22 | * \brief 人脸识别接口类。 它是所有人脸接口的基类 23 | * 24 | * \~ 25 | * \ingroup API 26 | */ 27 | class FACERECOGNIZER_EXPORT CFaceBase : public QObject 28 | { 29 | Q_OBJECT 30 | Q_CLASSINFO("Author", "Kang Lin ") 31 | 32 | Q_PROPERTY(QString modelPath READ getModelPath WRITE setModelPath) 33 | Q_PROPERTY(DEVICE device READ getDevice WRITE setDevice) 34 | 35 | public: 36 | explicit CFaceBase(QObject *parent = nullptr); 37 | 38 | virtual int setModelPath(const QString& szPath); 39 | virtual QString getModelPath(); 40 | 41 | enum DEVICE 42 | { 43 | CPU, 44 | GPU 45 | }; 46 | Q_ENUM(DEVICE) 47 | virtual DEVICE getDevice(); 48 | virtual int setDevice(DEVICE device); 49 | 50 | protected: 51 | virtual int UpdateParameter() = 0; 52 | 53 | private: 54 | QString m_szModelPath; 55 | DEVICE m_Device; 56 | }; 57 | 58 | #endif // CFACEBASE_H 59 | -------------------------------------------------------------------------------- /Src/FaceTools.cpp: -------------------------------------------------------------------------------- 1 | #include "FaceTools.h" 2 | 3 | CFaceTools::CFaceTools(CFace *pFace, QObject *parent) : CFaceBase(parent), 4 | m_pFace(pFace) 5 | {} 6 | -------------------------------------------------------------------------------- /Src/FaceTools.h: -------------------------------------------------------------------------------- 1 | #ifndef CFACETOOLS_H 2 | #define CFACETOOLS_H 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include "facerecognizer_export.h" 9 | #include "FaceBase.h" 10 | 11 | class CFace; 12 | /*! 13 | * \brief The CFaceTools class 14 | * 15 | * \~ 16 | * \ingroup API_FACE 17 | */ 18 | class FACERECOGNIZER_EXPORT CFaceTools : public CFaceBase 19 | { 20 | Q_OBJECT 21 | Q_CLASSINFO("Author", "Kang Lin ") 22 | 23 | public: 24 | explicit CFaceTools(CFace* pFace = nullptr, QObject *parent = nullptr); 25 | 26 | virtual float EvaluateQuality(const QImage &image, const QRect &face) = 0; 27 | 28 | protected: 29 | CFace* m_pFace; 30 | }; 31 | 32 | #endif // CFACETOOLS_H 33 | -------------------------------------------------------------------------------- /Src/ImageTool.h: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Kang Lin 3 | */ 4 | 5 | #ifndef TOOL_H 6 | #define TOOL_H 7 | 8 | //#if defined(_MSC_VER) && (_MSC_VER >= 1600) 9 | //#pragma execution_character_set("utf-8") 10 | //#endif 11 | 12 | #include "facerecognizer_export.h" 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "ConverFormat.h" 23 | 24 | /** 25 | * \~english Manage the plugins of image tool 26 | * 27 | * \~chinese 管理图像转换插件工具 28 | * 29 | * \~ 30 | * \ingroup API 31 | */ 32 | class FACERECOGNIZER_EXPORT CImageTool : public QObject 33 | { 34 | Q_OBJECT 35 | Q_CLASSINFO("Author", "Kang Lin ") 36 | 37 | public: 38 | explicit CImageTool(QObject *parent = nullptr); 39 | static CImageTool* Instance(); 40 | 41 | public: 42 | static void YUV420_2_RGB(unsigned char* pYUV, unsigned char* pRGB, int width, int height); 43 | QImage ConverFormatToRGB888(const QVideoFrame &frame); 44 | 45 | QString Detail(); 46 | 47 | private: 48 | CConverFormat* m_pConverFormat; 49 | 50 | int FindPlugins(QDir dir, QStringList filters); 51 | 52 | #if HAVE_LIBYUV 53 | static QImage LibyuvConverFormatToRGB888(const QVideoFrame &frame); 54 | #endif 55 | 56 | }; 57 | 58 | #endif // TOOL_H 59 | -------------------------------------------------------------------------------- /Src/Landmarker.cpp: -------------------------------------------------------------------------------- 1 | #include "Landmarker.h" 2 | 3 | CLandmarker::CLandmarker(CFace *pFace, QObject *parent) 4 | : CFaceBase(parent), 5 | m_pFace(pFace), 6 | m_nPoints(5) 7 | {} 8 | 9 | CLandmarker::~CLandmarker() 10 | {} 11 | 12 | int CLandmarker::Mark(const QImage &image, 13 | const QVector &faces, 14 | QVector > &points) 15 | { 16 | int nRet = 0; 17 | foreach(auto face, faces) 18 | { 19 | QVector p; 20 | nRet = Mark(image, face, p); 21 | if(nRet) return nRet; 22 | points.push_back(p); 23 | } 24 | return nRet; 25 | } 26 | 27 | int CLandmarker::setPoints(int nPoints) 28 | { 29 | m_nPoints = nPoints; 30 | UpdateParameter(); 31 | return 0; 32 | } 33 | 34 | int CLandmarker::getPoints() 35 | { 36 | return m_nPoints; 37 | } 38 | -------------------------------------------------------------------------------- /Src/Landmarker.h: -------------------------------------------------------------------------------- 1 | #ifndef CLANDMARKER_H_KL_2019_10_21 2 | #define CLANDMARKER_H_KL_2019_10_21 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "facerecognizer_export.h" 14 | #include "FaceBase.h" 15 | 16 | class CFace; 17 | /*! 18 | * \~english the class of face landmarker 19 | * 20 | * \~chinese 21 | * \brief 人脸标记接口类 22 | * 23 | * \~ 24 | * \ingroup API_FACE 25 | */ 26 | class FACERECOGNIZER_EXPORT CLandmarker : public CFaceBase 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int points READ getPoints WRITE setPoints) 30 | 31 | public: 32 | CLandmarker(CFace* pFace = nullptr, QObject *parent = nullptr); 33 | virtual ~CLandmarker(); 34 | 35 | virtual int Mark(const QImage &image, 36 | const QRect &face, 37 | QVector &points) = 0; 38 | virtual int Mark(const QImage &image, 39 | const QVector &faces, 40 | QVector > &points); 41 | 42 | virtual int getPoints(); 43 | virtual int setPoints(int nPoints); 44 | protected: 45 | virtual int UpdateParameter() = 0; 46 | 47 | CFace* m_pFace; 48 | 49 | private: 50 | int m_nPoints; 51 | }; 52 | 53 | #endif // CLANDMARKER_H_KL_2019_10_21 54 | -------------------------------------------------------------------------------- /Src/Plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | if(POLICY CMP0083) 4 | cmake_policy(SET CMP0083 NEW) 5 | endif() 6 | 7 | if(POLICY CMP0020) 8 | cmake_policy(SET CMP0020 NEW) 9 | endif() 10 | 11 | project(FaceRecognizerPlugins) 12 | 13 | #SUBDIRLIST(listPlugs ${CMAKE_CURRENT_SOURCE_DIR}) 14 | set(listPlugs LibFacedetection OpenCV ncnn Seeta FFmpge) 15 | foreach(sub ${listPlugs}) 16 | add_subdirectory(${sub}) 17 | if(TARGET Plugin${sub}) 18 | set(PLUG_LIBS ${PLUG_LIBS} Plugin${sub}) 19 | SET(PLUG_CONTENT "${PLUG_CONTENT}\nQ_IMPORT_PLUGIN(CFace${sub})") 20 | endif() 21 | endforeach() 22 | if(NOT BUILD_SHARED_LIBS) 23 | set(PLUGS_SOURCES_FILE ${CMAKE_BINARY_DIR}/PluginsSource.cpp) 24 | 25 | FILE(WRITE ${PLUGS_SOURCES_FILE} "#include \n") 26 | FILE(APPEND ${PLUGS_SOURCES_FILE} "#include \n") 27 | FILE(APPEND ${PLUGS_SOURCES_FILE} "${PLUG_CONTENT}\n") 28 | 29 | set(SOURCES_FILES ${SOURCES_FILES} ${PLUGS_SOURCES_FILE} PARENT_SCOPE) 30 | set(LIBS ${LIBS} ${PLUG_LIBS} PARENT_SCOPE) 31 | endif() 32 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(ANDROID) 2 | option(USE_FFMPEG "Use ffmpeg" OFF) 3 | else() 4 | option(USE_FFMPEG "Use ffmpeg" ON) 5 | endif() 6 | message(STATUS "Use ffmpeg: ${USE_FFMPEG}") 7 | if(NOT USE_FFMPEG) 8 | return() 9 | endif() 10 | 11 | find_package(FFMPEG CONFIG) 12 | if(NOT FFMPEG_FOUND) 13 | find_package(FFMPEG) 14 | if(NOT FFMPEG_FOUND) 15 | return() 16 | endif() 17 | endif() 18 | 19 | message(STATUS "FFMPGE:${FFMPEG_FOUND}") 20 | 21 | if(ANDROID) 22 | INSTALL(FILES ${FFMPEG_LIBRARIES} 23 | DESTINATION "libs/${ANDROID_ABI}" 24 | COMPONENT Runtime) 25 | elseif(WIN32) 26 | INSTALL(FILES ${FFMPEG_LIBRARIES} 27 | DESTINATION "${CMAKE_INSTALL_BINDIR}" 28 | COMPONENT Runtime) 29 | endif() 30 | 31 | if(QT_VERSION_MAJOR GREATER_EQUAL 6) 32 | return() 33 | endif() 34 | 35 | project(PluginConverFormatFFMpeg) 36 | 37 | set(SOURCES_FILES 38 | ConverFormatFFmpeg.cpp 39 | ) 40 | 41 | set(HEADER_FILES 42 | ConverFormatFFmpeg.h 43 | ) 44 | 45 | set(SOURCE_UI_FILES 46 | ) 47 | 48 | # Install target 49 | set(INSTALL_PATH ${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}) 50 | if(NOT ANDROID) 51 | set(INSTALL_PATH ${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}/ConverFormat) 52 | endif() 53 | ADD_PLUGIN_TARGET(NAME ${PROJECT_NAME} 54 | SOURCE_FILES ${SOURCES_FILES} ${HEADER_FILES} 55 | PRIVATE_LIBS ${FFMPEG_LIBRARIES} FaceRecognizer 56 | PRIVATE_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} 57 | PRIVATE_DEFINITIONS ${FFMPEG_DEFINITIONS} 58 | OUTPUT_DIR ${FACE_RECOGNIZER_PLUGS_BINARY_DIR}/ConverFormat 59 | INSTALL_DIR ${INSTALL_PATH} 60 | INSTALL_RPATH 61 | "$ORIGIN:$ORIGIN/../../lib:$ORIGIN/../../lib/${CMAKE_LIBRARY_ARCHITECTURE}" 62 | VERSION ${FaceRecognizer_VERSION}) 63 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_ar.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_ca.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_cs.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_da.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_el.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_en.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_en_GB.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_es.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_et.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_fi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_fr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_gd.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_gl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_hu.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_it.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_ja.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_ko.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_nb.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_ne.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_nl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_nn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_oc.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_pl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_pt_BR.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_pt_PT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_ro.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_sk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_sl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_sv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_th.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_tr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_uk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/FFmpge/Resource/Translations/PluginConverFormatFFMpeg_zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/LibFacedetection/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | option(USE_LIBFACEDETECTION "Use LibFacedetection" ON) 2 | message(STATUS "Use LibFacedetection: ${USE_LIBFACEDETECTION}") 3 | if(NOT USE_LIBFACEDETECTION) 4 | return() 5 | endif() 6 | 7 | project(PluginFaceLibFacedetection) 8 | 9 | find_package(facedetection) 10 | message(STATUS "Plugins libfacedetection:${facedetection_FOUND}") 11 | if(NOT facedetection_FOUND) 12 | return() 13 | endif() 14 | 15 | set(SOURCES_FILES 16 | FaceLibfacedetection.cpp 17 | DetectorLibfacedetection.cpp) 18 | set(HEADER_FILES 19 | FaceLibfacedetection.h 20 | DetectorLibfacedetection.h) 21 | 22 | #INSTALL_TARGETS(TARGETS facedetection) 23 | 24 | # Install target 25 | set(INSTALL_PATH ${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}) 26 | if(NOT ANDROID) 27 | set(INSTALL_PATH ${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}/Face) 28 | endif() 29 | ADD_PLUGIN_TARGET(NAME ${PROJECT_NAME} 30 | NO_TRANSLATION 31 | SOURCE_FILES ${SOURCES_FILES} ${HEADER_FILES} 32 | PRIVATE_LIBS facedetection FaceRecognizer 33 | OUTPUT_DIR ${FACE_RECOGNIZER_PLUGS_BINARY_DIR}/Face 34 | INSTALL_DIR ${INSTALL_PATH} 35 | INSTALL_RPATH 36 | "$ORIGIN:$ORIGIN/../../lib:$ORIGIN/../../lib/${CMAKE_LIBRARY_ARCHITECTURE}" 37 | VERSION ${FaceRecognizer_VERSION}) 38 | -------------------------------------------------------------------------------- /Src/Plugins/LibFacedetection/DetectorLibfacedetection.h: -------------------------------------------------------------------------------- 1 | #ifndef CDETECTORLIBFACEDETECTION_H 2 | #define CDETECTORLIBFACEDETECTION_H 3 | 4 | #pragma once 5 | #include "Detector.h" 6 | 7 | class CDetectorLibfacedetection : public CDetector 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit CDetectorLibfacedetection(CFace* pFace = nullptr, QObject *parent = nullptr); 12 | virtual int Detect(const QImage &image, QVector &faces); 13 | 14 | protected: 15 | virtual int UpdateParameter(); 16 | }; 17 | 18 | #endif // CDETECTORLIBFACEDETECTION_H 19 | -------------------------------------------------------------------------------- /Src/Plugins/LibFacedetection/FaceLibfacedetection.cpp: -------------------------------------------------------------------------------- 1 | #include "FaceLibfacedetection.h" 2 | #include "DetectorLibfacedetection.h" 3 | 4 | CFaceLibFacedetection::CFaceLibFacedetection(QObject *parent) : CFace(parent) 5 | {} 6 | 7 | int CFaceLibFacedetection::Initialize() 8 | { 9 | m_pDetector = new CDetectorLibfacedetection(this); 10 | return 0; 11 | } 12 | 13 | QString CFaceLibFacedetection::GetName() 14 | { 15 | return "libfacedetection"; 16 | } 17 | 18 | int CFaceLibFacedetection::GetLevel() 19 | { 20 | return 3; 21 | } 22 | -------------------------------------------------------------------------------- /Src/Plugins/LibFacedetection/FaceLibfacedetection.h: -------------------------------------------------------------------------------- 1 | #ifndef CFACELIBFACEDETECTION_H 2 | #define CFACELIBFACEDETECTION_H 3 | 4 | #pragma once 5 | 6 | #include "Face.h" 7 | 8 | class CFaceLibFacedetection : public CFace 9 | { 10 | Q_OBJECT 11 | public: 12 | CFaceLibFacedetection(QObject *parent = nullptr); 13 | 14 | Q_INTERFACES(CFace) 15 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 16 | Q_PLUGIN_METADATA(IID FACE_IID) 17 | #endif 18 | 19 | virtual int Initialize() override; 20 | QString GetName() override; 21 | int GetLevel() override; 22 | }; 23 | 24 | #endif // CFACELIBFACEDETECTION_H 25 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | option(USE_OPENCV "Use opencv" ON) 2 | if(NOT USE_OPENCV) 3 | return() 4 | endif() 5 | 6 | find_package(OpenCV) 7 | message(STATUS "Plug OpenCV:${OpenCV_FOUND};${OpenCV_LIBS}") 8 | if(NOT OpenCV_FOUND) 9 | return() 10 | endif() 11 | 12 | if(QT_VERSION_MAJOR LESS 6) 13 | PROJECT(PluginConverFormatOpenCV) 14 | 15 | set(SOURCES_FILES 16 | ConverFormatOpenCV.cpp 17 | ) 18 | set(HEADER_FILES 19 | ConverFormatOpenCV.h 20 | ) 21 | 22 | # Install target 23 | set(INSTALL_PATH ${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}) 24 | if(NOT ANDROID) 25 | set(INSTALL_PATH ${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}/ConverFormat) 26 | endif() 27 | ADD_PLUGIN_TARGET(NAME ${PROJECT_NAME} 28 | SOURCE_FILES ${SOURCES_FILES} ${HEADER_FILES} 29 | PRIVATE_LIBS ${OpenCV_LIBS} FaceRecognizer 30 | PRIVATE_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} 31 | PRIVATE_DEFINITIONS OpenCV_VERSION_MAJOR=${OpenCV_VERSION_MAJOR} 32 | OUTPUT_DIR ${FACE_RECOGNIZER_PLUGS_BINARY_DIR}/ConverFormat 33 | INSTALL_DIR ${INSTALL_PATH} 34 | VERSION ${FaceRecognizer_VERSION}) 35 | 36 | endif() 37 | 38 | foreach(opencv_component ${OpenCV_LIBS}) 39 | INSTALL_TARGETS(TARGETS ${opencv_component}) 40 | 41 | if((opencv_component STREQUAL "opencv_dnn") 42 | AND (OpenCV_VERSION VERSION_GREATER_EQUAL "3.4.0")) 43 | include(OpenCV_DNN.cmake) 44 | endif() 45 | 46 | if(opencv_component STREQUAL "opencv_face" 47 | AND OpenCV_VERSION VERSION_GREATER_EQUAL "3.4.0") 48 | include(OpenCV_Face.cmake) 49 | endif() 50 | endforeach() 51 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/ConverFormatOpenCV.h: -------------------------------------------------------------------------------- 1 | #ifndef CIMAGETOOLOPENCV_H 2 | #define CIMAGETOOLOPENCV_H 3 | 4 | #include "ConverFormat.h" 5 | 6 | /*! 7 | * \brief The CConverFormatOpenCV class 8 | * \ingroup API_CONVER_FORMAT 9 | */ 10 | class CConverFormatOpenCV final: public CConverFormat 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit CConverFormatOpenCV(QObject *parent = nullptr); 15 | 16 | Q_INTERFACES(CConverFormat) 17 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 18 | Q_PLUGIN_METADATA(IID CONVER_FORMAT_IID) 19 | #endif 20 | 21 | virtual QImage onConverFormatToRGB888(const QVideoFrame &frame) override; 22 | }; 23 | 24 | #endif // CIMAGETOOLOPENCV_H 25 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/DetectorOpenCV.h: -------------------------------------------------------------------------------- 1 | #ifndef DETECTOROPENCV_H 2 | #define DETECTOROPENCV_H 3 | 4 | #include "Detector.h" 5 | 6 | #include "opencv2/opencv.hpp" 7 | #include "opencv2/objdetect.hpp" 8 | 9 | class CDetectorOpenCV final : public CDetector 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit CDetectorOpenCV(CFace* pFace = nullptr, QObject *parent = nullptr); 14 | 15 | virtual int Detect(const QImage &image, QVector &faces); 16 | 17 | private: 18 | virtual int UpdateParameter(); 19 | 20 | cv::Ptr m_haar_cascade; 21 | bool m_bInit; 22 | }; 23 | 24 | #endif // DETECTOROPENCV_H 25 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/DetectorOpenCVDNN.h: -------------------------------------------------------------------------------- 1 | #ifndef DETECTOROPENCVDNN_H 2 | #define DETECTOROPENCVDNN_H 3 | 4 | #include "Detector.h" 5 | 6 | #include "opencv2/opencv.hpp" 7 | #include "opencv2/dnn.hpp" 8 | 9 | class CDetectorOpenCVDNN final : public CDetector 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit CDetectorOpenCVDNN(CFace* pFace = nullptr, QObject *parent = nullptr); 14 | virtual ~CDetectorOpenCVDNN(); 15 | 16 | virtual int Detect(const QImage &image, QVector &faces); 17 | 18 | private: 19 | virtual int UpdateParameter(); 20 | bool m_bInit; 21 | cv::dnn::Net m_Net; 22 | 23 | }; 24 | 25 | #endif // DETECTOROPENCVDNN_H 26 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/FaceOpenCV.cpp: -------------------------------------------------------------------------------- 1 | #include "FaceOpenCV.h" 2 | #include "DetectorOpenCV.h" 3 | #include "LandmarkerOpenCV.h" 4 | #include "DetectorOpenCVDNN.h" 5 | #include 6 | 7 | CFaceOpenCV::CFaceOpenCV(QObject *parent) : CFace(parent), 8 | m_Algorithm(NOT) 9 | {} 10 | 11 | int CFaceOpenCV::Initialize() 12 | { 13 | setAlgorithm(); 14 | return 0; 15 | } 16 | 17 | QString CFaceOpenCV::GetName() 18 | { 19 | return "OpencvFace"; 20 | } 21 | 22 | CFaceOpenCV::Algorithm CFaceOpenCV::getAlgorithm() 23 | { 24 | return m_Algorithm; 25 | } 26 | 27 | int CFaceOpenCV::setAlgorithm(Algorithm algorithm) 28 | { 29 | qDebug() << "CFaceOpenCV::setAlgorithm" << algorithm; 30 | if(m_Algorithm == algorithm) 31 | return 0; 32 | m_Algorithm = algorithm; 33 | 34 | switch (algorithm) { 35 | case OPENCV: 36 | if(m_pDetector) delete m_pDetector; 37 | m_pDetector = new CDetectorOpenCV(this); 38 | if(m_pLandmarker) delete m_pLandmarker; 39 | m_pLandmarker = new CLandmarkerOpenCV(this); 40 | break; 41 | case DNN: 42 | if(m_pDetector) delete m_pDetector; 43 | m_pDetector = new CDetectorOpenCVDNN(this); 44 | break; 45 | case NOT: 46 | Clean(); 47 | break; 48 | } 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/FaceOpenCV.h: -------------------------------------------------------------------------------- 1 | #ifndef FACEOPENCV_H 2 | #define FACEOPENCV_H 3 | 4 | #include "Face.h" 5 | 6 | class CFaceOpenCV final : public CFace 7 | { 8 | Q_OBJECT 9 | Q_PROPERTY(Algorithm algorithm READ getAlgorithm WRITE setAlgorithm) 10 | 11 | public: 12 | explicit CFaceOpenCV(QObject *parent = nullptr); 13 | 14 | Q_INTERFACES(CFace) 15 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 16 | Q_PLUGIN_METADATA(IID FACE_IID) 17 | #endif 18 | 19 | virtual int Initialize() override; 20 | QString GetName() override; 21 | 22 | enum Algorithm 23 | { 24 | OPENCV, 25 | DNN, 26 | NOT 27 | }; 28 | Q_ENUM(Algorithm) 29 | Algorithm getAlgorithm(); 30 | int setAlgorithm(Algorithm algorithm = OPENCV); 31 | private: 32 | Algorithm m_Algorithm; 33 | }; 34 | 35 | #endif // FACEOPENCV_H 36 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/FaceOpenCVDNN.cpp: -------------------------------------------------------------------------------- 1 | #include "FaceOpenCVDNN.h" 2 | #include "DetectorOpenCVDNN.h" 3 | 4 | CFaceOpenCVDNN::CFaceOpenCVDNN(QObject *parent) : CFace(parent) 5 | {} 6 | 7 | int CFaceOpenCVDNN::Initialize() 8 | { 9 | m_pDetector = new CDetectorOpenCVDNN(this); 10 | return 0; 11 | } 12 | 13 | QString CFaceOpenCVDNN::GetName() 14 | { 15 | return "OpencvDNN"; 16 | } 17 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/FaceOpenCVDNN.h: -------------------------------------------------------------------------------- 1 | #ifndef CFACEOPENCVDNN_H 2 | #define CFACEOPENCVDNN_H 3 | 4 | #include "Face.h" 5 | class CFaceOpenCVDNN : public CFace 6 | { 7 | Q_OBJECT 8 | public: 9 | explicit CFaceOpenCVDNN(QObject *parent = nullptr); 10 | 11 | Q_INTERFACES(CFace) 12 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 13 | Q_PLUGIN_METADATA(IID FACE_IID) 14 | #endif 15 | 16 | virtual int Initialize() override; 17 | QString GetName() override; 18 | }; 19 | 20 | #endif // CFACEOPENCVDNN_H 21 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/LandmarkerOpenCV.h: -------------------------------------------------------------------------------- 1 | #ifndef LANDMARKEROPENCV_H 2 | #define LANDMARKEROPENCV_H 3 | 4 | /** 5 | * @diafile 利用OpenCV的LBF算法进行人脸关键点检测 6 | * @author Kang Lin(kl222@126.com) 7 | * @ref [1]Tutorial: https://www.learnopencv.com/facemark-facial-landmark-detection-using-opencv/ 8 | * @ref [2]Code: https://github.com/spmallick/learnopencv/tree/master/FacialLandmarkDetection 9 | * @note OpenCV3.4以及上支持Facemark 10 | * 11 | */ 12 | 13 | //https://github.com/amusi/opencv-facial-landmark-detection 14 | 15 | #include 16 | 17 | #ifdef HAVE_OPENCV_FACE 18 | #include 19 | #endif 20 | 21 | #include "Landmarker.h" 22 | 23 | class CLandmarkerOpenCV final : public CLandmarker 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit CLandmarkerOpenCV(CFace* pFace = nullptr, QObject *parent = nullptr); 28 | 29 | virtual int Mark(const QImage &image, 30 | const QRect &face, 31 | QVector &points); 32 | virtual int Mark(const QImage &image, 33 | const QVector &faces, 34 | QVector > &points); 35 | private: 36 | virtual int UpdateParameter(); 37 | bool m_bInit; 38 | 39 | cv::Ptr m_Facemark; 40 | }; 41 | 42 | #endif // LANDMARKEROPENCV_H 43 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/RecognizerOpenCV.h: -------------------------------------------------------------------------------- 1 | #ifndef RECOGNIZEROPENCV_H 2 | #define RECOGNIZEROPENCV_H 3 | 4 | #include "Recognizer.h" 5 | #include "opencv2/core.hpp" 6 | #include "opencv2/face.hpp" 7 | 8 | class CRecognizerOpenCV final: public CRecognizer 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit CRecognizerOpenCV(CFace* pFace = nullptr, QObject *parent = nullptr); 13 | 14 | /** 15 | * @brief Register face and save register image 16 | * @param image: face image 17 | * @return register index. other return -1. 18 | */ 19 | virtual qint64 Register(const QImage& image, const QRect &face = QRect()); 20 | 21 | virtual int Delete(const qint64 &index); 22 | /** 23 | * @brief Query register face 24 | * @param image: query face image 25 | * @return find index. other return -1 26 | */ 27 | virtual qint64 Query(const QImage& image, const QRect &face = QRect()); 28 | 29 | /** 30 | * @brief Save feature to file 31 | * @param szFile: feature file name 32 | * @return 33 | */ 34 | virtual int Save(const QString &szFile = QString()); 35 | /** 36 | * @brief Load feature from file 37 | * @param szFile: feature file name 38 | * @return 39 | */ 40 | virtual int Load(const QString &szFile = QString()); 41 | 42 | protected: 43 | virtual int UpdateParameter(); 44 | 45 | cv::Ptr m_Recognizer; 46 | qint64 m_nMaxIndex; 47 | }; 48 | 49 | #endif // RECOGNIZEROPENCV_H 50 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_ar.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_ca.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_cs.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_da.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_el.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_en.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_en_GB.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_es.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_et.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_fi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_fr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_gd.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_gl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_hu.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_it.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_ja.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_ko.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_nb.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_ne.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_nl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_nn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_oc.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_pl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_pt_BR.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_pt_PT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_ro.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_sk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_sl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_sv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_th.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_tr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_uk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginConverFormatOpenCV_zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_ar.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_ca.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_cs.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_da.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_el.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_en.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_en_GB.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_es.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_et.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_fi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_fr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_gd.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_gl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_hu.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_it.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_ja.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_ko.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_nb.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_ne.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_nl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_nn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_oc.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_pl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_pt_BR.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_pt_PT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_ro.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_sk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_sl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_sv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_th.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_tr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_uk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/OpenCV/Resource/Translations/PluginFaceOpencvFace_zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/DetectorSeeta.h: -------------------------------------------------------------------------------- 1 | #ifndef CDETECTORSEETA_H_KL_2019_10_29 2 | #define CDETECTORSEETA_H_KL_2019_10_29 3 | 4 | #pragma once 5 | 6 | #include "Detector.h" 7 | #include "seeta/FaceDetector.h" 8 | #include 9 | #include 10 | 11 | class CDetectorSeeta final: public CDetector 12 | { 13 | Q_OBJECT 14 | Q_CLASSINFO("Author", "Kang Lin ") 15 | Q_PROPERTY(int minFaceSize READ getMinFaceSize WRITE setMinFaceSize) 16 | 17 | public: 18 | CDetectorSeeta(CFace* pFace = nullptr, QObject *parent = nullptr); 19 | virtual ~CDetectorSeeta() override; 20 | 21 | virtual int Detect(const QImage &image, QVector &faces) override; 22 | 23 | int getMinFaceSize(); 24 | int setMinFaceSize(int size); 25 | 26 | protected: 27 | virtual int UpdateParameter() override; 28 | 29 | private: 30 | QSharedPointer m_Dector; 31 | bool m_bInit; 32 | int m_MinFaceSize; 33 | }; 34 | 35 | #endif // CDETECTORSEETA_H_KL_2019_10_29 36 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/FaceSeeta2.cpp: -------------------------------------------------------------------------------- 1 | #include "FaceSeeta2.h" 2 | 3 | #include "DetectorSeeta.h" 4 | #include "TrackerSeeta.h" 5 | #include "LandmarkerSeeta.h" 6 | #include "RecognizerSeeta.h" 7 | #include "FaceToolsSeeta.h" 8 | 9 | #include 10 | #include 11 | 12 | static Q_LOGGING_CATEGORY(log, "Plugin.Seeta.Face") 13 | 14 | CFaceSeeta2::CFaceSeeta2(QObject *parent) : CFace(parent) 15 | {} 16 | 17 | CFaceSeeta2::~CFaceSeeta2() 18 | {} 19 | 20 | int CFaceSeeta2::Initialize() 21 | { 22 | m_pDetector = new CDetectorSeeta(this); 23 | m_pTracker = new CTrackerSeeta(this); 24 | m_pLandmarker = new CLandmarkerSeeta(this); 25 | m_pRecognizer = new CRecognizerSeeta(this); 26 | m_pFaceTools = new CFaceToolsSeeta(this); 27 | return 0; 28 | } 29 | 30 | QString CFaceSeeta2::GetName() 31 | { 32 | return "SeetaFace2"; 33 | } 34 | 35 | int CFaceSeeta2::GetLevel() 36 | { 37 | return 10; 38 | } 39 | 40 | const QString CFaceSeeta2::Detail() const 41 | { 42 | QString szDetail; 43 | szDetail = tr("### Seeta2") + "\n"; 44 | if(m_pDetector) 45 | szDetail += tr("- Detector"); 46 | if(m_pRecognizer) 47 | szDetail += tr("- Recognizer"); 48 | if(m_pLandmarker) 49 | szDetail += tr("- Landmarker"); 50 | if(m_pTracker) 51 | szDetail += tr("- Tracker"); 52 | if(m_pFaceTools) 53 | szDetail += tr("- Face tools"); 54 | return szDetail; 55 | } 56 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/FaceSeeta2.h: -------------------------------------------------------------------------------- 1 | #ifndef CFACESEETA_H_KL_2019_10_21 2 | #define CFACESEETA_H_KL_2019_10_21 3 | 4 | #pragma once 5 | 6 | #include "Face.h" 7 | 8 | class CFaceSeeta2 final: public CFace 9 | { 10 | Q_OBJECT 11 | Q_CLASSINFO("Author", "Kang Lin ") 12 | 13 | public: 14 | CFaceSeeta2(QObject* parent = nullptr); 15 | virtual ~CFaceSeeta2() override; 16 | 17 | Q_INTERFACES(CFace) 18 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 19 | Q_PLUGIN_METADATA(IID FACE_IID) 20 | #endif 21 | 22 | virtual int Initialize() override; 23 | QString GetName() override; 24 | int GetLevel() override; 25 | 26 | const QString Detail() const override; 27 | }; 28 | 29 | #endif // CFACESEETA_H_KL_2019_10_21 30 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/FaceToolsSeeta.cpp: -------------------------------------------------------------------------------- 1 | #include "FaceToolsSeeta.h" 2 | #include "Performance.h" 3 | #include "Face.h" 4 | #include 5 | 6 | static Q_LOGGING_CATEGORY(log, "Plugin.Seeta.Tools") 7 | 8 | CFaceToolsSeeta::CFaceToolsSeeta(CFace *pFace, QObject *parent) 9 | : CFaceTools(pFace, parent) 10 | { 11 | m_MinFaceSize = 80; 12 | } 13 | 14 | int CFaceToolsSeeta::getMinFaceSize() 15 | { 16 | return m_MinFaceSize; 17 | } 18 | 19 | int CFaceToolsSeeta::setMinFaceSize(int size) 20 | { 21 | m_MinFaceSize = size; 22 | UpdateParameter(); 23 | return 0; 24 | } 25 | 26 | int CFaceToolsSeeta::UpdateParameter() 27 | { 28 | m_QualityAssessor.setFaceSize(getMinFaceSize()); 29 | return 0; 30 | } 31 | 32 | float CFaceToolsSeeta::EvaluateQuality(const QImage &image, const QRect &face) 33 | { 34 | if(image.isNull()) return -1; 35 | PERFORMANCE(CFaceToolsSeeta) 36 | QImage img = image; 37 | if(img.format() != QImage::Format_RGB888) 38 | { 39 | PERFORMANCE_START(CFaceToolsSeeta) 40 | img = img.convertToFormat(QImage::Format_RGB888); 41 | PERFORMANCE_ADD_TIME(CFaceToolsSeeta, 42 | "convert format, image width:" 43 | + QString::number(image.width()) 44 | + ";Height:" 45 | + QString::number(image.height())) 46 | } 47 | img = img.rgbSwapped(); 48 | PERFORMANCE_ADD_TIME(CFaceToolsSeeta, "rgbSwapped") 49 | SeetaImageData data; 50 | data.width = img.width(); 51 | data.height = img.height(); 52 | data.channels = 3; 53 | data.data = img.bits(); 54 | 55 | SeetaRect rect = {face.x(), face.y(), face.width(), face.height()}; 56 | 57 | QVector points; 58 | int nRet = m_pFace->GetLandmarker()->Mark(image, face, points); 59 | if(nRet) return 0; 60 | std::vector p; 61 | foreach (QPointF point, points) { 62 | SeetaPointF pp = {point.x(), point.y()}; 63 | p.push_back(pp); 64 | } 65 | return m_QualityAssessor.evaluate(data, rect, p.data()); 66 | } 67 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/FaceToolsSeeta.h: -------------------------------------------------------------------------------- 1 | #ifndef CFACETOOLSSEETA_H 2 | #define CFACETOOLSSEETA_H 3 | 4 | #include "FaceTools.h" 5 | #include "seeta/QualityAssessor.h" 6 | 7 | #include 8 | #include 9 | 10 | class CFaceToolsSeeta final: public CFaceTools 11 | { 12 | Q_OBJECT 13 | Q_CLASSINFO("Author", "Kang Lin ") 14 | Q_PROPERTY(int minFaceSize READ getMinFaceSize WRITE setMinFaceSize) 15 | 16 | public: 17 | explicit CFaceToolsSeeta(CFace* pFace = nullptr, QObject *parent = nullptr); 18 | virtual float EvaluateQuality(const QImage &image, const QRect &face); 19 | 20 | int getMinFaceSize(); 21 | int setMinFaceSize(int size); 22 | 23 | private: 24 | virtual int UpdateParameter(); 25 | seeta::QualityAssessor m_QualityAssessor; 26 | int m_MinFaceSize; 27 | }; 28 | 29 | #endif // CFACETOOLSSEETA_H 30 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/LandmarkerSeeta.h: -------------------------------------------------------------------------------- 1 | #ifndef CLANDMARKERSEETA_H_KL_2019_10_21 2 | #define CLANDMARKERSEETA_H_KL_2019_10_21 3 | 4 | #pragma once 5 | #include "Landmarker.h" 6 | #include "seeta/FaceLandmarker.h" 7 | 8 | #include 9 | #include 10 | 11 | class CLandmarkerSeeta : public CLandmarker 12 | { 13 | Q_OBJECT 14 | Q_CLASSINFO("Author", "Kang Lin ") 15 | 16 | public: 17 | CLandmarkerSeeta(CFace* pFace = nullptr, QObject* parent = nullptr); 18 | virtual ~CLandmarkerSeeta(); 19 | 20 | virtual int Mark(const QImage &image, const QRect &face, QVector &points); 21 | 22 | private: 23 | virtual int UpdateParameter(); 24 | QSharedPointer m_Landmarker; 25 | bool m_bInit; 26 | }; 27 | 28 | #endif // CLANDMARKERSEETA_H_KL_2019_10_21 29 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_ar.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_ca.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_cs.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_da.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_el.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_en.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_en_GB.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_es.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_et.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_fi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_fr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_gd.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_gl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_hu.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_it.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_ja.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_ko.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_nb.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_ne.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_nl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_nn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_oc.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_pl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_pt_BR.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_pt_PT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_ro.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_sk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_sl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_sv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_th.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_tr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_uk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/Resource/Translations/PluginFaceSeeta_zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/Seeta/TrackerSeeta.h: -------------------------------------------------------------------------------- 1 | #ifndef CTRACKERSEETA_H 2 | #define CTRACKERSEETA_H 3 | 4 | #include 5 | #include 6 | 7 | #include "Tracker.h" 8 | #include "seeta/FaceTracker.h" 9 | 10 | class CTrackerSeeta final : public CTracker 11 | { 12 | Q_OBJECT 13 | Q_CLASSINFO("Author", "Kang Lin ") 14 | 15 | public: 16 | explicit CTrackerSeeta(CFace* pFace = nullptr, QObject *parent = nullptr); 17 | 18 | virtual int Track(const QImage &image, QVector &faces); 19 | 20 | private: 21 | virtual int UpdateParameter(); 22 | 23 | QSharedPointer m_Tracker; 24 | bool m_bInit; 25 | }; 26 | 27 | #endif // CTRACKERSEETA_H 28 | -------------------------------------------------------------------------------- /Src/Plugins/Test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | option(USE_TEST "Use test" OFF) 2 | message(STATUS "== Use test: ${USE_TEST}") 3 | if(NOT USE_TEST) 4 | return() 5 | endif() 6 | 7 | project(PluginTest) 8 | 9 | set(SOURCES_FILES 10 | Test.cpp 11 | ) 12 | 13 | set(HEADER_FILES 14 | Test.h 15 | ) 16 | 17 | set(SOURCE_UI_FILES 18 | ${SOURCE_UI_FILES} 19 | ) 20 | 21 | add_library(${PROJECT_NAME} ${SOURCES_FILES} ${HEADER_FILES}) 22 | set_target_properties(${PROJECT_NAME} PROPERTIES 23 | LIBRARY_OUTPUT_DIRECTORY ${FACE_RECOGNIZER_PLUGS_BINARY_DIR} 24 | ARCHIVE_OUTPUT_DIRECTORY ${FACE_RECOGNIZER_PLUGS_BINARY_DIR} 25 | RUNTIME_OUTPUT_DIRECTORY ${FACE_RECOGNIZER_PLUGS_BINARY_DIR} 26 | VERSION ${BUILD_VERSION}) 27 | target_link_libraries(${PROJECT_NAME} PUBLIC FaceRecognizer RabbitCommon ${QT_LIBRARIES} ${LIBS}) 28 | target_include_directories(${PROJECT_NAME} 29 | PRIVATE ${RabbitCommon_DIR}/Src 30 | ${CMAKE_SOURCE_DIR}/Src 31 | ${CMAKE_BINARY_DIR} 32 | ${INCLUDE_DIRS}) 33 | 34 | # Install target 35 | INSTALL(TARGETS ${PROJECT_NAME} 36 | EXPORT ${PROJECT_NAME}Config 37 | RUNTIME DESTINATION "${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}" 38 | COMPONENT Runtime 39 | LIBRARY DESTINATION "${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}" 40 | COMPONENT Runtime 41 | ARCHIVE DESTINATION "${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}" 42 | ) 43 | 44 | export(TARGETS ${PROJECT_NAME} 45 | APPEND FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake 46 | ) 47 | 48 | # Install cmake configure files 49 | install(EXPORT ${PROJECT_NAME}Config 50 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake" 51 | ) 52 | write_basic_package_version_file( 53 | "${CMAKE_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" 54 | VERSION ${BUILD_VERSION} 55 | COMPATIBILITY AnyNewerVersion) 56 | install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake") 57 | -------------------------------------------------------------------------------- /Src/Plugins/Test/Test.cpp: -------------------------------------------------------------------------------- 1 | #include "Test.h" 2 | #include "Log.h" 3 | 4 | CFaceTest::CFaceTest(QObject *parent) : CFace(parent) 5 | {} 6 | 7 | CFaceTest::~CFaceTest() 8 | {} 9 | 10 | int CFaceTest::Initialize(CFactoryFace *pFactoryFace) 11 | { 12 | int nRet = 0; 13 | LOG_MODEL_INFO("Test", "CFaceTest::Initialize"); 14 | nRet = pFactoryFace->RegisterFace("Test", this, tr("Test")); 15 | return nRet; 16 | } 17 | 18 | int CFaceTest::Clean(CFactoryFace* pFactoryFace) 19 | { 20 | int nRet = 0; 21 | nRet = pFactoryFace->RemoveFace("Test"); 22 | return nRet; 23 | } 24 | -------------------------------------------------------------------------------- /Src/Plugins/Test/Test.h: -------------------------------------------------------------------------------- 1 | #ifndef CTEST_H 2 | #define CTEST_H 3 | 4 | #include 5 | #include "FactoryFace.h" 6 | 7 | class CFaceTest : public CFace 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit CFaceTest(QObject *parent = nullptr); 12 | virtual ~CFaceTest() override; 13 | 14 | Q_INTERFACES(CFace) 15 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 16 | Q_PLUGIN_METADATA(IID "KangLinStudio.Rabbit.FaceRecognizer.Plugs.Test.CTest") 17 | #endif 18 | 19 | int Initialize(CFactoryFace* pFactoryFace = nullptr) override; 20 | int Clean(CFactoryFace* pFactoryFace = nullptr) override; 21 | }; 22 | 23 | #endif // CTEST_H 24 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | option(USE_NCNN "Use ncnn" OFF) 2 | message(STATUS "Use ncnn: ${USE_NCNN}") 3 | if(NOT USE_NCNN) 4 | return() 5 | endif() 6 | 7 | project(PluginFaceNcnn) 8 | find_package(ncnn) 9 | message(STATUS "Plugins ncnn:${ncnn_FOUND}") 10 | if(NOT ncnn_FOUND) 11 | return() 12 | endif() 13 | 14 | # 现在ncnn编译出来的是静态库,所以不需要安装 15 | #INSTALL_TARGETS(TARGETS ncnn) 16 | 17 | set(SOURCES_FILES 18 | FaceNcnn.cpp 19 | DetectorNcnnRetina.cpp 20 | ) 21 | 22 | set(HEADER_FILES 23 | FaceNcnn.h 24 | DetectorNcnnRetina.h 25 | ) 26 | 27 | # Install target 28 | set(INSTALL_PATH ${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}) 29 | if(NOT ANDROID) 30 | set(INSTALL_PATH ${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}/Face) 31 | endif() 32 | ADD_PLUGIN_TARGET(NAME ${PROJECT_NAME} 33 | SOURCE_FILES ${SOURCES_FILES} ${HEADER_FILES} 34 | PRIVATE_LIBS ncnn FaceRecognizer 35 | OUTPUT_DIR ${FACE_RECOGNIZER_PLUGS_BINARY_DIR}/Face 36 | INSTALL_DIR ${INSTALL_PATH} 37 | INSTALL_RPATH 38 | "$ORIGIN:$ORIGIN/../../lib:$ORIGIN/../../lib/${CMAKE_LIBRARY_ARCHITECTURE}" 39 | VERSION ${FaceRecognizer_VERSION}) 40 | 41 | # Install model files 42 | if(NOT EXISTS "${CMAKE_SOURCE_DIR}/model/ncnn") 43 | if(ENABLE_DOWNLOAD_MODULE) 44 | DOWNLOAD(FILENAME "model_ncnn.tar.gz" 45 | HASH fd4a88dcf16c29fdeadc852eb9776ffb 46 | URL "https://github.com/KangLin/ncnn_example/releases/download/model/model_ncnn.tar.gz" 47 | DESTINATION_DIR "${CMAKE_SOURCE_DIR}/model/ncnn" 48 | STATUS retval UNPACK) 49 | else(ENABLE_DOWNLOAD_MODULE) 50 | message(AUTHOR_WARNING "Please set ENABLE_DOWNLOAD_MODULE to ON " 51 | " to automation download, or manual download ncnn model files from" 52 | " https://github.com/KangLin/ncnn_example/releases/download/model/model_ncnn.tar.gz" 53 | " to ${CMAKE_SOURCE_DIR}/model/ncnn and tar xzvf model_ncnn.tar.gz") 54 | endif(ENABLE_DOWNLOAD_MODULE) 55 | endif() 56 | if(EXISTS "${CMAKE_SOURCE_DIR}/model/ncnn") 57 | INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/model/ncnn 58 | DESTINATION ${INSTALL_DATA_PREFIX}/model 59 | COMPONENT Runtime) 60 | endif() 61 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/DetectorNcnnRetina.h: -------------------------------------------------------------------------------- 1 | #ifndef CDetectorNcnnRetina_H 2 | #define CDetectorNcnnRetina_H 3 | 4 | #include "Detector.h" 5 | #include "net.h" 6 | #include 7 | 8 | class CDetectorNcnnRetina : public CDetector 9 | { 10 | Q_OBJECT 11 | Q_CLASSINFO("Author", "Kang Lin ") 12 | 13 | public: 14 | explicit CDetectorNcnnRetina(CFace* pFace = nullptr, QObject *parent = nullptr); 15 | 16 | virtual int Detect(const QImage &image, QVector &faces) override; 17 | 18 | protected: 19 | virtual int UpdateParameter() override; 20 | 21 | private: 22 | bool m_bInit; 23 | struct FaceInfo { 24 | QRect location; 25 | float score; 26 | float keypoints[10]; 27 | bool mask; 28 | }; 29 | 30 | ncnn::Net* m_pNet; 31 | using ANCHORS = QVector; 32 | std::vector m_Anchors; 33 | const int m_RPNs[3] = { 32, 16, 8 }; 34 | const QSize m_InputSize = {300, 300}; 35 | const float m_IouThreshold = 0.4f; 36 | const float m_ScoreThreshold = 0.8f; 37 | 38 | int GenerateAnchors(const int & base_size, 39 | const QVector& ratios, 40 | const QVector scales, 41 | QVector* anchors); 42 | int RatioAnchors(const QRect &anchor, 43 | const QVector& ratios, 44 | QVector* anchors); 45 | int ScaleAnchors(const QVector& ratio_anchors, 46 | const QVector& scales, 47 | QVector* anchors); 48 | }; 49 | 50 | #endif // CDetectorNcnnRetina_H 51 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/FaceNcnn.cpp: -------------------------------------------------------------------------------- 1 | #include "FaceNcnn.h" 2 | #include "DetectorNcnnRetina.h" 3 | 4 | CFaceNcnn::CFaceNcnn(QObject *parent) : CFace(parent), 5 | m_DectorAlgorithm(NOT) 6 | {} 7 | 8 | CFaceNcnn::~CFaceNcnn() 9 | {} 10 | 11 | int CFaceNcnn::Initialize() 12 | { 13 | setDectorAlgorithm(); 14 | return 0; 15 | } 16 | 17 | QString CFaceNcnn::GetName() 18 | { 19 | return "ncnn"; 20 | } 21 | 22 | CFaceNcnn::DectorAlgorithm CFaceNcnn::getDectorAlgorithm() 23 | { 24 | return m_DectorAlgorithm; 25 | } 26 | 27 | int CFaceNcnn::setDectorAlgorithm(DectorAlgorithm algorithm) 28 | { 29 | if(m_DectorAlgorithm == algorithm) 30 | return 0; 31 | m_DectorAlgorithm = algorithm; 32 | if(m_pDetector) delete m_pDetector; 33 | 34 | switch (m_DectorAlgorithm) { 35 | case RETINA: 36 | m_pDetector = new CDetectorNcnnRetina(this); 37 | break; 38 | case NOT: 39 | Clean(); 40 | break; 41 | } 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/FaceNcnn.h: -------------------------------------------------------------------------------- 1 | #ifndef CFACENCNN_H 2 | #define CFACENCNN_H 3 | 4 | #include "Face.h" 5 | 6 | class CFaceNcnn : public CFace 7 | { 8 | Q_OBJECT 9 | Q_CLASSINFO("Author", "Kang Lin ") 10 | Q_PROPERTY(DectorAlgorithm dectorAlgorithm READ getDectorAlgorithm WRITE setDectorAlgorithm) 11 | 12 | public: 13 | explicit CFaceNcnn(QObject *parent = nullptr); 14 | virtual ~CFaceNcnn() override; 15 | 16 | Q_INTERFACES(CFace) 17 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 18 | Q_PLUGIN_METADATA(IID FACE_IID) 19 | #endif 20 | 21 | virtual int Initialize() override; 22 | virtual QString GetName() override; 23 | 24 | enum DectorAlgorithm 25 | { 26 | NOT, 27 | RETINA 28 | }; 29 | Q_ENUM(DectorAlgorithm) 30 | DectorAlgorithm getDectorAlgorithm(); 31 | int setDectorAlgorithm(DectorAlgorithm algorithm = RETINA); 32 | private: 33 | DectorAlgorithm m_DectorAlgorithm; 34 | }; 35 | 36 | #endif // CFACENCNN_H 37 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_ar.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_ca.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_cs.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_da.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_el.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_en.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_en_GB.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_es.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_et.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_fi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_fr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_gd.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_gl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_hu.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_it.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_ja.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_ko.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_nb.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_ne.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_nl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_nn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_oc.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_pl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_pt_BR.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_pt_PT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_ro.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_sk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_sl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_sv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_th.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_tr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_uk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Plugins/ncnn/Resource/Translations/PluginFaceNcnn_zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Recognizer.cpp: -------------------------------------------------------------------------------- 1 | #include "Recognizer.h" 2 | #include 3 | #include "RabbitCommonDir.h" 4 | 5 | CRecognizer::CRecognizer(CFace *pFace, QObject *parent) 6 | : CFaceBase(parent), 7 | m_pFace(pFace), 8 | m_bInit(false) 9 | { 10 | m_szImagePath = RabbitCommon::CDir::Instance()->GetDirUserImage(); 11 | QDir d(m_szImagePath); 12 | if(!d.exists(m_szImagePath)) 13 | d.mkpath(m_szImagePath); 14 | } 15 | 16 | CRecognizer::~CRecognizer() 17 | {} 18 | 19 | QString CRecognizer::GetRegisterImage(qint64 index) 20 | { 21 | if(0 > index) 22 | return getImagePath(); 23 | 24 | return getImagePath() 25 | + QDir::separator() 26 | + QString::number(index) + ".png"; 27 | } 28 | 29 | bool CRecognizer::IsValid() 30 | { 31 | return m_bInit; 32 | } 33 | 34 | QString CRecognizer::getImagePath() 35 | { 36 | return m_szImagePath; 37 | } 38 | 39 | int CRecognizer::setImagePath(const QString &szPath) 40 | { 41 | m_szImagePath = szPath; 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /Src/Recognizer.h: -------------------------------------------------------------------------------- 1 | #ifndef CRECOGNIZER_H_KL_2019_10_21_ 2 | #define CRECOGNIZER_H_KL_2019_10_21_ 3 | 4 | #pragma once 5 | #include 6 | #include 7 | #include 8 | 9 | #include "facerecognizer_export.h" 10 | #include "FaceBase.h" 11 | 12 | class CFace; 13 | 14 | /** 15 | * \~english the class of face recognizer 16 | * \~chinese 人脸识别接口类 17 | * \~ 18 | * \ingroup API_FACE 19 | */ 20 | class FACERECOGNIZER_EXPORT CRecognizer : public CFaceBase 21 | { 22 | Q_OBJECT 23 | Q_CLASSINFO("Author", "Kang Lin ") 24 | 25 | Q_PROPERTY(QString imagePath READ getImagePath WRITE setImagePath) 26 | 27 | public: 28 | CRecognizer(CFace* pFace = nullptr, QObject* parent = nullptr); 29 | virtual ~CRecognizer(); 30 | 31 | /** 32 | * @brief Register face and save register image 33 | * @param image: face image 34 | * @return register index. other return -1. 35 | */ 36 | virtual qint64 Register(const QImage& image, 37 | const QRect &face = QRect()) = 0; 38 | 39 | virtual int Delete(const qint64 &index) = 0; 40 | 41 | /** 42 | * @brief Query registered face 43 | * @param image: query face image 44 | * @return find index. other return -1 45 | */ 46 | virtual qint64 Query(const QImage& image, const QRect &face = QRect()) = 0; 47 | 48 | /** 49 | * @brief Save feature to file 50 | * @param szFile: feature file name 51 | * @return 52 | */ 53 | virtual int Save(const QString &szFile = QString()) = 0; 54 | /** 55 | * @brief Load feature from file 56 | * @param szFile: feature file name 57 | * @return 58 | */ 59 | virtual int Load(const QString &szFile = QString()) = 0; 60 | 61 | /** 62 | * @brief GetRegisterImage 63 | * @param index: search register image index. 64 | * when is -1, get register image path 65 | * @return register image file or path 66 | */ 67 | virtual QString GetRegisterImage(qint64 index = -1); 68 | 69 | virtual bool IsValid(); 70 | 71 | QString getImagePath(); 72 | int setImagePath(const QString &szPath); 73 | 74 | protected: 75 | CFace* m_pFace; 76 | bool m_bInit; 77 | QString m_szImagePath; 78 | }; 79 | 80 | #endif // CRECOGNIZER_H_KL_2019_10_21_ 81 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_ar.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_ca.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_cs.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_da.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_el.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_en.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_en_GB.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_es.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_et.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_fi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_fr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_gd.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_gl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_hu.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_it.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_ja.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_ko.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_nb.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_ne.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_nl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_nn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_oc.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_pl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_pt_BR.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_pt_PT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_ro.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_sk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_sl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_sv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_th.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_tr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_uk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_zh.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_zh_rCN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Resource/Translations/FaceRecognizer_zh_rTW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Src/Tracker.cpp: -------------------------------------------------------------------------------- 1 | #include "Tracker.h" 2 | 3 | static int gTrackStrFaceId = qRegisterMetaType(); 4 | static int gVectorTrackStrFaceId = qRegisterMetaType >(); 5 | CTracker::CTracker(CFace *pFace, QObject *parent) : CFaceBase(parent), 6 | m_pFace(pFace) 7 | {} 8 | -------------------------------------------------------------------------------- /Src/Tracker.h: -------------------------------------------------------------------------------- 1 | #ifndef CTRACKER_H 2 | #define CTRACKER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "facerecognizer_export.h" 12 | #include "FaceBase.h" 13 | 14 | class CFace; 15 | /*! 16 | * \~english the class of face tracker 17 | * 18 | * \~chinse 人脸跟踪接口类 19 | * 20 | * \~ 21 | * \ingroup API_FACE 22 | */ 23 | class FACERECOGNIZER_EXPORT CTracker : public CFaceBase 24 | { 25 | Q_OBJECT 26 | Q_CLASSINFO("Author", "Kang Lin ") 27 | 28 | public: 29 | explicit CTracker(CFace* pFace = nullptr, QObject *parent = nullptr); 30 | 31 | struct strFace 32 | { 33 | QRect rect; 34 | int pid; 35 | }; 36 | 37 | virtual int Track(const QImage &image, QVector &faces) = 0; 38 | 39 | protected: 40 | CFace* m_pFace; 41 | }; 42 | 43 | Q_DECLARE_METATYPE(CTracker::strFace) 44 | 45 | #endif // CTRACKER_H 46 | -------------------------------------------------------------------------------- /Src/database/DataRegister.cpp: -------------------------------------------------------------------------------- 1 | #include "DataRegister.h" 2 | 3 | CDataRegister::CDataRegister(QObject *parent) : QObject(parent) 4 | { 5 | m_nIdx = -1; 6 | m_nNo = -1; 7 | } 8 | 9 | CDataRegister::CDataRegister(const CDataRegister &other) 10 | { 11 | m_nIdx = other.m_nIdx; 12 | m_nNo = other.m_nNo; 13 | m_szName = other.m_szName; 14 | } 15 | 16 | CDataRegister& CDataRegister::operator=(const CDataRegister &other) 17 | { 18 | m_nIdx = other.m_nIdx; 19 | m_nNo = other.m_nNo; 20 | m_szName = other.m_szName; 21 | return *this; 22 | } 23 | 24 | qint64 CDataRegister::getIdx() 25 | { 26 | return m_nIdx; 27 | } 28 | 29 | int CDataRegister::setIdx(qint64 idx) 30 | { 31 | m_nIdx = idx; 32 | return 0; 33 | } 34 | 35 | qint64 CDataRegister::getNo() 36 | { 37 | return m_nNo; 38 | } 39 | 40 | int CDataRegister::setNo(qint64 nNo) 41 | { 42 | m_nNo = nNo; 43 | return 0; 44 | } 45 | 46 | QString CDataRegister::getName() 47 | { 48 | return m_szName; 49 | } 50 | 51 | int CDataRegister::setName(const QString &szName) 52 | { 53 | m_szName = szName; 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /Src/database/DataRegister.h: -------------------------------------------------------------------------------- 1 | #ifndef CDATAREGISTER_H 2 | #define CDATAREGISTER_H 3 | 4 | #include 5 | #include "facerecognizer_export.h" 6 | 7 | class FACERECOGNIZER_EXPORT CDataRegister : public QObject 8 | { 9 | Q_OBJECT 10 | 11 | Q_PROPERTY(qint64 idx READ getIdx WRITE setIdx) 12 | Q_PROPERTY(qint64 no READ getNo WRITE setNo) 13 | Q_PROPERTY(QString name READ getName WRITE setName) 14 | 15 | public: 16 | explicit CDataRegister(QObject *parent = nullptr); 17 | CDataRegister(const CDataRegister &other); 18 | CDataRegister& operator=(const CDataRegister&); 19 | qint64 getIdx(); 20 | int setIdx(qint64 idx); 21 | 22 | qint64 getNo(); 23 | int setNo(qint64 nNo); 24 | 25 | QString getName(); 26 | int setName(const QString &szName); 27 | 28 | private: 29 | qint64 m_nIdx; 30 | qint64 m_nNo; 31 | QString m_szName; 32 | }; 33 | 34 | #endif // CDATAREGISTER_H 35 | -------------------------------------------------------------------------------- /Src/database/Database.h: -------------------------------------------------------------------------------- 1 | #ifndef CDATABASE_H 2 | #define CDATABASE_H 3 | 4 | #include 5 | #include 6 | #include "DataRegister.h" 7 | #include "TableRegister.h" 8 | 9 | class FACERECOGNIZER_EXPORT CDatabase : public QObject 10 | { 11 | Q_OBJECT 12 | Q_PROPERTY(QString dbFile READ getDbFile WRITE setDbFile) 13 | public: 14 | explicit CDatabase(QObject *parent = nullptr); 15 | virtual ~CDatabase(); 16 | 17 | CTableRegister* GetTableRegister(); 18 | QString getDbFile(); 19 | int setDbFile(const QString &szFile); 20 | 21 | private: 22 | int InitDatabase(); 23 | 24 | QSqlDatabase m_Database; 25 | CTableRegister m_TableRegister; 26 | 27 | QString m_szFile; 28 | }; 29 | 30 | #endif // CDATABASE_H 31 | -------------------------------------------------------------------------------- /Src/database/TableRegister.h: -------------------------------------------------------------------------------- 1 | #ifndef CTABLEREGISTER_H 2 | #define CTABLEREGISTER_H 3 | 4 | #include 5 | #include 6 | #include "DataRegister.h" 7 | 8 | class FACERECOGNIZER_EXPORT CTableRegister : public QObject 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit CTableRegister(QObject *parent = nullptr); 14 | 15 | int SetDatabase(const QSqlDatabase &); 16 | int Register(qint64 index, CDataRegister *pData); 17 | int Delete(qint64 index); 18 | int GetRegisterInfo(qint64 index, CDataRegister *pData); 19 | /** 20 | * @brief IsExistNo 21 | * @param no: when is -1, determine if the registry has data 22 | * @return 23 | */ 24 | bool IsExistNo(qint64 no = -1); 25 | 26 | private: 27 | QSqlDatabase m_Database; 28 | }; 29 | 30 | #endif // CTABLEREGISTER_H 31 | -------------------------------------------------------------------------------- /Src/yuv2rgb/rgb2yuv.h: -------------------------------------------------------------------------------- 1 | #ifndef _RGB2YUV_H_ 2 | #define _RGB2YUV_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | void init_lookup_table(); 9 | 10 | // 转换过程中会丢失部分信息 11 | int rgb24_to_yuv420(int x_dim, int y_dim, unsigned char *bmp, unsigned char *yuv, int flip); 12 | 13 | int rgb2yuv(); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif /* _RGB2YUV_H_ */ -------------------------------------------------------------------------------- /Update/update.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | v0.0.4 4 | 5 | -------------------------------------------------------------------------------- /Update/update_android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 0 7 | android 8 | android 9 | armv7 10 | 11 | 12 | v0.0.3 13 | 14 | -------------------------------------------------------------------------------- /ci/backgroud_echo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ev 3 | 4 | num=0 5 | while [ $num -le 10 ] ; 6 | do sleep 300 ; 7 | num=$(($num+1)) ; 8 | echo '5 min\n' ; 9 | done 10 | -------------------------------------------------------------------------------- /cmake/FindLIBYUV.cmake: -------------------------------------------------------------------------------- 1 | ### FindLIBYUV.cmake --- 2 | ## 3 | ## Author: Kang Lin 4 | 5 | # - Try to find LIBYUV 6 | # Once done this will define 7 | # 8 | # LIBYUV_FOUND - system has LIBYUV 9 | # LIBYUV_INCLUDE_DIRS - the LIBYUV include directory 10 | # LIBYUV_LIBRARIES - Link these to use LIBYUV 11 | # LIBYUV_DEFINITIONS - Compiler switches required for using LIBYUV 12 | 13 | # Redistribution and use is allowed according to the terms of the New 14 | # BSD license. 15 | 16 | include(FindPackageHandleStandardArgs) 17 | 18 | find_path(LIBYUV_INCLUDE_DIR 19 | NAMES libyuv.h 20 | PATHS ${LIBYUV_DIR} /opt/libyuv /usr /usr/local /opt/local 21 | PATH_SUFFIXES include 22 | ) 23 | 24 | find_library(LIBYUV_LIBRARY 25 | NAMES yuv 26 | PATHS ${LIBYUV_DIR} /opt/libyuv /usr /usr/local /opt/local 27 | PATH_SUFFIXES lib 28 | ) 29 | 30 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBYUV 31 | LIBYUV_INCLUDE_DIR LIBYUV_LIBRARY) 32 | 33 | mark_as_advanced(LIBYUV_INCLUDE_DIR LIBYUV_LIBRARY) 34 | 35 | if(LIBYUV_FOUND) 36 | set(LIBYUV_INCLUDE_DIRS ${LIBYUV_INCLUDE_DIR}) 37 | set(LIBYUV_LIBRARIES ${LIBYUV_LIBRARY}) 38 | else() 39 | message("Don't found libyuv. please set -DLIBYUV_DIR=") 40 | endif() 41 | 42 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | facerecognizer (0.0.4) unstable; urgency=medium 2 | 3 | * Initial Release. 4 | 5 | -- Kang Lin Sat, 20 Apr 2019 19:53:02 -0700 6 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | # https://www.debian.org/doc/manuals/maint-guide/dreq.zh-cn.html#control 2 | # https://www.debian.org/doc/debian-policy/ch-controlfields.html 3 | 4 | Source: facerecognizer 5 | Section: main 6 | Priority: optional 7 | Maintainer: Kang Lin 8 | Build-Depends: debhelper (>=13~), debhelper-compat (=13), fakeroot, cmake, 9 | libssl-dev, rabbitcommon-dev (>=2.2.4), 10 | qt6-tools-dev, qt6-tools-dev-tools, qt6-base-dev, qt6-base-dev-tools, 11 | qt6-l10n-tools, qt6-translations-l10n, qt6-scxml-dev, 12 | qt6-webengine-dev, qt6-webengine-dev-tools 13 | Standards-Version: 4.6.2 14 | Homepage: https://github.com/KangLin/FaceRecognizer 15 | Vcs-Git: https://github.com/KangLin/FaceRecognizer.git 16 | #Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/FaceRecognizer.git 17 | 18 | Package: facerecognizer 19 | Architecture: any 20 | Pre-Depends: ${misc:Pre-Depends} 21 | Depends: ${shlibs:Depends}, ${misc:Depends} 22 | Replaces: rabbitcommon (>=2) 23 | Description: Face recognizer 24 | -------------------------------------------------------------------------------- /debian/postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # postrm script for FaceRecognizer 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `purge' 11 | # * `upgrade' 12 | # * `failed-upgrade' 13 | # * `abort-install' 14 | # * `abort-install' 15 | # * `abort-upgrade' 16 | # * `disappear' 17 | # 18 | # for details, see https://www.debian.org/doc/debian-policy/ or 19 | # the debian-policy package 20 | 21 | 22 | case "$1" in 23 | purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) 24 | rm -fr /usr/share/applications/org.Rabbit.FaceRecognizer.desktop 25 | rm -fr /etc/ld.so.conf.d/FaceRecognizer.conf 26 | rm -fr /usr/share/pixmaps/org.Rabbit.FaceRecognizer.png 27 | ldconfig 28 | ;; 29 | 30 | *) 31 | echo "postrm called with unknown argument \`$1'" >&2 32 | exit 1 33 | ;; 34 | esac 35 | 36 | # dh_installdeb will replace this with shell code automatically 37 | # generated by other debhelper scripts. 38 | 39 | #DEBHELPER# 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /debian/preinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # preinst script for FaceRecognizer 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `install' 10 | # * `install' 11 | # * `upgrade' 12 | # * `abort-upgrade' 13 | # for details, see https://www.debian.org/doc/debian-policy/ or 14 | # the debian-policy package 15 | 16 | 17 | case "$1" in 18 | install|upgrade) 19 | export QT_VERSION= 20 | if [ -n "${QT_VERSION}" ]; then 21 | sudo add-apt-repository -y ppa:beineri/opt-qt-${QT_VERSION}-`lsb_release -c|awk '{print $2}'` 22 | sudo apt-get update 23 | fi 24 | ;; 25 | 26 | abort-upgrade) 27 | ;; 28 | 29 | *) 30 | echo "preinst called with unknown argument \`$1'" >&2 31 | exit 1 32 | ;; 33 | esac 34 | 35 | # dh_installdeb will replace this with shell code automatically 36 | # generated by other debhelper scripts. 37 | 38 | #DEBHELPER# 39 | 40 | exit 0 41 | -------------------------------------------------------------------------------- /debian/prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # prerm script for Tasks 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `upgrade' 11 | # * `failed-upgrade' 12 | # * `remove' `in-favour' 13 | # * `deconfigure' `in-favour' 14 | # `removing' 15 | # 16 | # for details, see https://www.debian.org/doc/debian-policy/ or 17 | # the debian-policy package 18 | 19 | 20 | case "$1" in 21 | remove|upgrade|deconfigure) 22 | ;; 23 | 24 | failed-upgrade) 25 | ;; 26 | 27 | *) 28 | echo "prerm called with unknown argument \`$1'" >&2 29 | exit 1 30 | ;; 31 | esac 32 | 33 | # dh_installdeb will replace this with shell code automatically 34 | # generated by other debhelper scripts. 35 | 36 | #DEBHELPER# 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | # Compulsory line, this is a version 4 file 2 | version=4 3 | 4 | # GitHub hosted projects 5 | opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%-$1.tar.gz%" \ 6 | https://github.com/KangLin/FaceRecognizer/tags \ 7 | (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate 8 | -------------------------------------------------------------------------------- /docs/Develop.md: -------------------------------------------------------------------------------- 1 | 2 | ### 插件 3 | 4 | 本项目包括以下插件: 5 | 6 | - 图像格式转换 7 | + [CConverFormat 接口类](../Src/ConverFormat.h) 8 | + 插件位置: 9 | - android: 应用程序目录下 10 | - windows、linux: 应用程序安装目录/plugins/ConverFormat 11 | + 插件命名:project(PluginConverXXXX) 12 | - 人脸识别 13 | + [CFace 接口类](../Src/Face.h) 14 | + 插件位置: 15 | - android: 应用程序目录下 16 | - windows、linux: 应用程序安装目录/plugins/Face 17 | + 插件命名:project(PluginFaceXXXX) 18 | 插件加载详见: [Src/FactoryFace.cpp 中的 CFactoryFace::FindPlugins 函数](../Src/FactoryFace.cpp) 19 | -------------------------------------------------------------------------------- /docs/Doxygen/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/Doxygen/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Face Recognizer 6 | 7 | 8 |

Face Recognizer

9 |

Author: Kang Lin Email: kl222@126.com 10 |

11 | 12 |

Project repository position

13 | 28 | 29 |

Development documentation

30 |

Please select your language:

31 |
  • English
  • 32 |
  • 中文
  • 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/Learn.md: -------------------------------------------------------------------------------- 1 | 学习资料 2 | ------- 3 | 4 | - [HyperDL-Tutorial](https://github.com/zeusees/HyperDL-Tutorial) 5 | - [learnopencv](https://github.com/spmallick/learnopencv) 6 | - [Qt自定义委托在QTableView中绘制控件、图片、文字](https://www.iteye.com/blog/qimo601-1539147) 7 | - [一款入门级的人脸、视频、文字检测以及识别的项目](https://github.com/vipstone/faceai) 8 | - [ncnn_example](https://github.com/MirrorYuChen/ncnn_example) 9 | 10 | - [如何通俗易懂地解释卷积?](https://www.zhihu.com/question/22298352) 11 | - [Understanding Convolutions](http://colah.github.io/posts/2014-07-Understanding-Convolutions/) 12 | - [20年的目标检测大综述](https://mp.weixin.qq.com/s?__biz=MzU0NTAyNTQ1OQ==&mid=2247488979&idx=1&sn=3149df1068797385f2b828bb669b3907&chksm=fb72690fcc05e01912ad5e98ff13c799b59948cd7915609e0f6b530ea61c4e7c78a182c8cb75&scene=0&xtrack=1&exportkey=AUERuxDgY0feHML7Sx4Mid8%3D&pass_ticket=g03p4Sgi%2F5ZIEPyHK0Q1Dfa1iz8cqgwBhcZCy%2FMhQFFnoPkUudU2KLIkD6Njy%2FCA#rd) 13 | - [人脸系列:人脸检测、人脸关键点定位、人脸优选、人脸对齐、人脸特征提取、人脸跟踪、人脸活体检测](https://blog.csdn.net/TheDayIn_CSDN/article/details/93199307) 14 | - [RPN(区域生成网络)](https://www.cnblogs.com/Terrypython/p/10584384.html) 15 | - [RetinaFace] 16 | + [RetinaFace(开源简化版)详细解读](https://blog.csdn.net/warrentdrew/article/details/98742948?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1) 17 | + [RetinaFace论文阅读](https://blog.csdn.net/PPLLO_o/article/details/97760996?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3) 18 | + [Face Detection-RetinaFace解读](https://blog.csdn.net/TheDayIn_CSDN/article/details/95058236?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-6&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-6) 19 | + [RetinaFace论文解析](https://blog.csdn.net/wzjwj/article/details/94456036) 20 | -------------------------------------------------------------------------------- /etc/FaceRecognizer_logqt.ini: -------------------------------------------------------------------------------- 1 | [Log] 2 | ;; Log file path. 3 | ;Path=log 4 | ;; Log file name prefix 5 | DateFormat="yyyy-MM-dd" 6 | ;; Message format pattern. See: https://doc.qt.io/qt-6/qtlogging.html#qSetMessagePattern 7 | Pattern="[%{time hh:mm:ss.zzz} %{pid}|%{threadid} %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}E%{endif}%{if-fatal}F%{endif}] %{category} - %{message}" 8 | ;[%{file}:%{line}, %{function}]" 9 | ;; Log file length 10 | ;Length=100M 11 | ;; Log file count 12 | ;Count=10 13 | ;; Write log file interval 14 | ;Interval=1 15 | 16 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 17 | ;; Log rules 18 | ;; Please see QLoggingCategory documents: https://doc.qt.io/qt-6/qloggingcategory.html#logging-rules 19 | ;; Format: 20 | ;; [.] = true|false 21 | [Rules] 22 | ;*=false 23 | *.debug=false 24 | ;*.warning=false 25 | 26 | ;RabbitCommon*=false 27 | ;RabbitCommon.Updater=true 28 | 29 | Face*=true 30 | -------------------------------------------------------------------------------- /share/FaceRecognizer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | #获取运行的程序名 6 | PRONAME=`basename $0` 7 | #获取文件运行的当前目录 8 | #current_dir=$(cd "$(dirname "$0")"; pwd) 9 | 10 | cd "$(dirname "$0")"/.. 11 | INSTALL_PATH=`pwd` 12 | echo "INSTALL_PATH:$INSTALL_PATH" 13 | export LD_LIBRARY_PATH=$INSTALL_PATH/bin:$INSTALL_PATH/lib:$INSTALL_PATH/lib/`uname -m`-linux-gnu:$LD_LIBRARY_PATH 14 | echo "LD_LIBRARY_PATH:$LD_LIBRARY_PATH" 15 | $INSTALL_PATH/bin/FaceRecognizerApp $* 16 | -------------------------------------------------------------------------------- /share/org.Rabbit.FaceRecognizer.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Icon=org.Rabbit.FaceRecognizer 4 | 5 | Exec=/opt/FaceRecognizer/bin/FaceRecognizer.sh 6 | Path=/opt/FaceRecognizer 7 | Terminal=false 8 | StartupNotify=true 9 | Categories=Application;Development;Tools;Qt 10 | 11 | Name=FaceRecognizer 12 | GenericName=FaceRecognizer 13 | Comment=FaceRecognizer 14 | 15 | Name[zh_CN]=人脸识别 16 | GenericName[zh_CN]=人脸识别 17 | Comment[zh_CN]=人脸识别 18 | 19 | Name[zh_TW]=人臉識別 20 | GenericName[zh_TW]=人臉識別 21 | Comment[zh_TW]=人臉識別 22 | -------------------------------------------------------------------------------- /test/test_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | EXIT_CODE=0 4 | PROJECT_NAME="FaceRecognizer" 5 | 6 | if [ -n "$1" ]; then 7 | echo "$PROJECT_NAME" 8 | PROJECT_NAME=$1 9 | fi 10 | 11 | if [ ! -f /opt/${PROJECT_NAME}/share/applications/org.Rabbit.${PROJECT_NAME}.desktop ]; then 12 | echo "There are not /opt/share/applications/org.Rabbit.${PROJECT_NAME}.desktop" 13 | EXIT_CODE=$[EXIT_CODE+1] 14 | fi 15 | 16 | if [ ! -f /usr/share/applications/org.Rabbit.${PROJECT_NAME}.desktop ]; then 17 | echo "There are not /usr/share/applications/org.Rabbit.${PROJECT_NAME}.desktop" 18 | EXIT_CODE=$[EXIT_CODE+1] 19 | fi 20 | 21 | if [ ! -f /opt/${PROJECT_NAME}/share/pixmaps/${PROJECT_NAME}.png ]; then 22 | echo "There are not /opt/${PROJECT_NAME}/share/pixmaps/${PROJECT_NAME}.png" 23 | EXIT_CODE=$[EXIT_CODE+1] 24 | fi 25 | 26 | if [ ! -f /usr/share/pixmaps/org.Rabbit.${PROJECT_NAME}.png ]; then 27 | echo "There are not /usr/share/pixmaps/org.Rabbit.${PROJECT_NAME}.png" 28 | EXIT_CODE=$[EXIT_CODE+1] 29 | fi 30 | 31 | 32 | exit $EXIT_CODE 33 | -------------------------------------------------------------------------------- /vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "facerecognizer", 3 | "version-string":"0.0.4", 4 | "license": "GPL-3.0", 5 | "homepage": "https://github.com/KangLin/facerecognizer", 6 | 7 | "dependencies": [ 8 | "openssl" 9 | ], 10 | 11 | "features": { 12 | "seetaface": { 13 | "description": "seetaface", 14 | "dependencies": [ 15 | { 16 | "name": "opencv", 17 | "features": [ 18 | "ffmpeg" 19 | ] 20 | } 21 | ] 22 | }, 23 | "opencv": { 24 | "description": "opencv", 25 | "dependencies": [ 26 | { 27 | "name": "opencv", 28 | "default-features": true, 29 | "features": [ 30 | "contrib", 31 | "ffmpeg" 32 | ] 33 | } 34 | ] 35 | }, 36 | "dlib": { 37 | "description": "dlib", 38 | "dependencies": [ 39 | "dlib" 40 | ] 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vcpkg/ports/openssl/install-pc-files.cmake: -------------------------------------------------------------------------------- 1 | function(install_pc_file name pc_data) 2 | if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") 3 | configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${name}.pc" @ONLY) 4 | endif() 5 | if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") 6 | configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${name}.pc" @ONLY) 7 | endif() 8 | endfunction() 9 | 10 | install_pc_file(openssl [[ 11 | Name: OpenSSL 12 | Description: Secure Sockets Layer and cryptography libraries and tools 13 | Requires: libssl libcrypto 14 | ]]) 15 | 16 | install_pc_file(libssl [[ 17 | Name: OpenSSL-libssl 18 | Description: Secure Sockets Layer and cryptography libraries 19 | Libs: -L"${libdir}" -llibssl 20 | Requires: libcrypto 21 | Cflags: -I"${includedir}" 22 | ]]) 23 | 24 | install_pc_file(libcrypto [[ 25 | Name: OpenSSL-libcrypto 26 | Description: OpenSSL cryptography library 27 | Libs: -L"${libdir}" -llibcrypto 28 | Libs.private: -lcrypt32 -lws2_32 29 | Cflags: -I"${includedir}" 30 | ]]) 31 | 32 | vcpkg_fixup_pkgconfig() 33 | -------------------------------------------------------------------------------- /vcpkg/ports/openssl/openssl.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | Version: @OPENSSL_VERSION@ 6 | @pc_data@ 7 | -------------------------------------------------------------------------------- /vcpkg/ports/openssl/portfile.cmake: -------------------------------------------------------------------------------- 1 | if(EXISTS "${CURRENT_INSTALLED_DIR}/include/openssl/ssl.h") 2 | message(FATAL_ERROR "Can't build openssl if libressl/boringssl is installed. Please remove libressl/boringssl, and try install openssl again if you need it.") 3 | endif() 4 | 5 | set(OPENSSL_VERSION 1.1.1n) 6 | vcpkg_download_distfile( 7 | ARCHIVE 8 | URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" "https://www.openssl.org/source/old/1.1.1/openssl-${OPENSSL_VERSION}.tar.gz" 9 | FILENAME "openssl-${OPENSSL_VERSION}.tar.gz" 10 | SHA512 1937796736613dcf4105a54e42ecb61f95a1cea74677156f9459aea0f2c95159359e766089632bf364ee6b0d28d661eb9957bce8fecc9d2436378d8d79e8d0a4 11 | ) 12 | 13 | vcpkg_find_acquire_program(PERL) 14 | get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) 15 | vcpkg_add_to_path("${PERL_EXE_PATH}") 16 | 17 | if(VCPKG_TARGET_IS_UWP) 18 | include("${CMAKE_CURRENT_LIST_DIR}/uwp/portfile.cmake") 19 | include("${CMAKE_CURRENT_LIST_DIR}/install-pc-files.cmake") 20 | elseif(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) 21 | include("${CMAKE_CURRENT_LIST_DIR}/windows/portfile.cmake") 22 | include("${CMAKE_CURRENT_LIST_DIR}/install-pc-files.cmake") 23 | else() 24 | include("${CMAKE_CURRENT_LIST_DIR}/unix/portfile.cmake") 25 | endif() 26 | 27 | configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) 28 | file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") 29 | -------------------------------------------------------------------------------- /vcpkg/ports/openssl/unix/portfile.cmake: -------------------------------------------------------------------------------- 1 | vcpkg_extract_source_archive_ex( 2 | OUT_SOURCE_PATH MASTER_COPY_SOURCE_PATH 3 | ARCHIVE "${ARCHIVE}" 4 | REF ${OPENSSL_VERSION} 5 | ) 6 | 7 | if(CMAKE_HOST_WIN32) 8 | vcpkg_acquire_msys(MSYS_ROOT PACKAGES make perl) 9 | set(MAKE ${MSYS_ROOT}/usr/bin/make.exe) 10 | set(PERL ${MSYS_ROOT}/usr/bin/perl.exe) 11 | else() 12 | find_program(MAKE make) 13 | if(NOT MAKE) 14 | message(FATAL_ERROR "Could not find make. Please install it through your package manager.") 15 | endif() 16 | endif() 17 | 18 | vcpkg_cmake_configure( 19 | SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR} 20 | OPTIONS 21 | -DSOURCE_PATH=${MASTER_COPY_SOURCE_PATH} 22 | -DPERL=${PERL} 23 | -DMAKE=${MAKE} 24 | -DVCPKG_CONCURRENCY=${VCPKG_CONCURRENCY} 25 | ) 26 | 27 | vcpkg_cmake_install() 28 | vcpkg_fixup_pkgconfig() 29 | 30 | file(GLOB HEADERS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/include/openssl/*.h) 31 | set(RESOLVED_HEADERS) 32 | foreach(HEADER ${HEADERS}) 33 | get_filename_component(X "${HEADER}" REALPATH) 34 | list(APPEND RESOLVED_HEADERS "${X}") 35 | endforeach() 36 | 37 | file(INSTALL ${RESOLVED_HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include/openssl) 38 | file(INSTALL ${MASTER_COPY_SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) 39 | -------------------------------------------------------------------------------- /vcpkg/ports/openssl/unix/remove-deps.cmake: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE MAKEFILES ${DIR}/*/Makefile) 2 | foreach(MAKEFILE ${MAKEFILES}) 3 | message("removing deps from ${MAKEFILE}") 4 | file(READ "${MAKEFILE}" _contents) 5 | string(REGEX REPLACE "\n# DO NOT DELETE THIS LINE.*" "" _contents "${_contents}") 6 | file(WRITE "${MAKEFILE}" "${_contents}") 7 | endforeach() 8 | -------------------------------------------------------------------------------- /vcpkg/ports/openssl/usage: -------------------------------------------------------------------------------- 1 | The package openssl is compatible with built-in CMake targets: 2 | 3 | find_package(OpenSSL REQUIRED) 4 | target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto) 5 | -------------------------------------------------------------------------------- /vcpkg/ports/openssl/uwp/make-openssl.bat: -------------------------------------------------------------------------------- 1 | set build=%1 2 | 3 | perl Configure no-asm no-hw no-dso VC-WINUNIVERSAL -FS -FIWindows.h 4 | 5 | for /D %%f in ("%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.FoundationContract\*") do set LibPath=%LibPath%;%%f\ 6 | for /D %%f in ("%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.UniversalApiContract\*") do set LibPath=%LibPath%;%%f\ 7 | for /D %%f in ("%WindowsSdkDir%References\Windows.Foundation.FoundationContract\*") do set LibPath=%LibPath%;%%f\ 8 | for /D %%f in ("%WindowsSdkDir%References\Windows.Foundation.UniversalApiContract\*") do set LibPath=%LibPath%;%%f\ 9 | 10 | call ms\do_winuniversal.bat 11 | 12 | mkdir inc32\openssl 13 | 14 | jom -j %NUMBER_OF_PROCESSORS% -k -f ms\ntdll.mak 15 | REM due to a race condition in the build, we need to have a second single-threaded pass. 16 | nmake -f ms\ntdll.mak 17 | -------------------------------------------------------------------------------- /vcpkg/ports/openssl/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "openssl", 3 | "version-string": "1.1.1n", 4 | "description": "OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.", 5 | "homepage": "https://www.openssl.org", 6 | "license": "OpenSSL", 7 | "dependencies": [ 8 | { 9 | "name": "vcpkg-cmake", 10 | "host": true 11 | }, 12 | { 13 | "name": "vcpkg-cmake-config", 14 | "host": true 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /vcpkg/ports/openssl/windows/flags.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf 2 | index 66bc81d..2364633 100644 3 | --- a/Configurations/10-main.conf 4 | +++ b/Configurations/10-main.conf 5 | @@ -1302,7 +1302,7 @@ my %targets = ( 6 | inherit_from => [ "BASE_Windows" ], 7 | template => 1, 8 | CC => "cl", 9 | - CPP => '"$(CC)" /EP /C', 10 | + CPP => '$(CC) /EP /C', 11 | CFLAGS => "/W3 /wd4090 /nologo", 12 | coutflag => "/Fo", 13 | LD => "link", 14 | diff --git a/Configure b/Configure 15 | index 8b234f6..e031768 100644 16 | --- a/Configure 17 | +++ b/Configure 18 | @@ -680,7 +680,7 @@ my $list_separator_re = 19 | # (we supported those before the change to "make variable" support. 20 | my %user = ( 21 | AR => env('AR'), 22 | - ARFLAGS => [], 23 | + ARFLAGS => [ env('ARFLAGS') || () ], 24 | AS => undef, 25 | ASFLAGS => [], 26 | CC => env('CC'), 27 | @@ -693,7 +693,7 @@ my %user = ( 28 | CPPINCLUDES => [], # Alternative for -I 29 | CROSS_COMPILE => env('CROSS_COMPILE'), 30 | HASHBANGPERL=> env('HASHBANGPERL') || env('PERL'), 31 | - LD => undef, 32 | + LD => env('LD'), 33 | LDFLAGS => [ env('LDFLAGS') || () ], # -L, -Wl, 34 | LDLIBS => [ env('LDLIBS') || () ], # -l 35 | MT => undef, 36 | --------------------------------------------------------------------------------