-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79ebca4
commit 7260a84
Showing
4 changed files
with
336 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Form implementation generated from reading ui file 'raw_ui_files/FaceRecognitionScreen.ui' | ||
# | ||
# Created by: PyQt5 UI code generator 5.15.10 | ||
# | ||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is | ||
# run again. Do not edit this file unless you know what you are doing. | ||
|
||
|
||
from PyQt5 import QtCore, QtGui, QtWidgets | ||
|
||
|
||
class Ui_FaceRecognitionWidget(object): | ||
def setupUi(self, FaceRecognitionWidget): | ||
FaceRecognitionWidget.setObjectName("FaceRecognitionWidget") | ||
FaceRecognitionWidget.resize(1165, 763) | ||
self.gridLayout_4 = QtWidgets.QGridLayout(FaceRecognitionWidget) | ||
self.gridLayout_4.setObjectName("gridLayout_4") | ||
self.widget_sourceImage = QtWidgets.QWidget(FaceRecognitionWidget) | ||
self.widget_sourceImage.setMinimumSize(QtCore.QSize(320, 320)) | ||
self.widget_sourceImage.setObjectName("widget_sourceImage") | ||
self.gridLayout = QtWidgets.QGridLayout(self.widget_sourceImage) | ||
self.gridLayout.setObjectName("gridLayout") | ||
self.label_soruceImageShower = QtWidgets.QLabel(self.widget_sourceImage) | ||
self.label_soruceImageShower.setMinimumSize(QtCore.QSize(320, 320)) | ||
self.label_soruceImageShower.setText("") | ||
self.label_soruceImageShower.setObjectName("label_soruceImageShower") | ||
self.gridLayout.addWidget(self.label_soruceImageShower, 0, 0, 1, 1) | ||
self.gridLayout_4.addWidget(self.widget_sourceImage, 0, 0, 1, 1) | ||
self.widget_decetedImage = QtWidgets.QWidget(FaceRecognitionWidget) | ||
self.widget_decetedImage.setMinimumSize(QtCore.QSize(320, 320)) | ||
self.widget_decetedImage.setObjectName("widget_decetedImage") | ||
self.gridLayout_2 = QtWidgets.QGridLayout(self.widget_decetedImage) | ||
self.gridLayout_2.setObjectName("gridLayout_2") | ||
self.label_detectedImageShower = QtWidgets.QLabel(self.widget_decetedImage) | ||
self.label_detectedImageShower.setMinimumSize(QtCore.QSize(320, 320)) | ||
self.label_detectedImageShower.setText("") | ||
self.label_detectedImageShower.setObjectName("label_detectedImageShower") | ||
self.gridLayout_2.addWidget(self.label_detectedImageShower, 0, 0, 1, 1) | ||
self.gridLayout_4.addWidget(self.widget_decetedImage, 0, 1, 1, 1) | ||
self.widget = QtWidgets.QWidget(FaceRecognitionWidget) | ||
self.widget.setObjectName("widget") | ||
self.gridLayout_3 = QtWidgets.QGridLayout(self.widget) | ||
self.gridLayout_3.setObjectName("gridLayout_3") | ||
self.progressBar_benzerlikBari = QtWidgets.QProgressBar(self.widget) | ||
self.progressBar_benzerlikBari.setProperty("value", 0) | ||
self.progressBar_benzerlikBari.setObjectName("progressBar_benzerlikBari") | ||
self.gridLayout_3.addWidget(self.progressBar_benzerlikBari, 1, 3, 1, 2) | ||
self.pushButton_selectSourceImage = QtWidgets.QPushButton(self.widget) | ||
self.pushButton_selectSourceImage.setObjectName("pushButton_selectSourceImage") | ||
self.gridLayout_3.addWidget(self.pushButton_selectSourceImage, 0, 2, 1, 1) | ||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) | ||
self.gridLayout_3.addItem(spacerItem, 0, 0, 1, 1) | ||
self.pushButton_startDbSearch = QtWidgets.QPushButton(self.widget) | ||
self.pushButton_startDbSearch.setObjectName("pushButton_startDbSearch") | ||
self.gridLayout_3.addWidget(self.pushButton_startDbSearch, 1, 0, 1, 1) | ||
self.label = QtWidgets.QLabel(self.widget) | ||
self.label.setObjectName("label") | ||
self.gridLayout_3.addWidget(self.label, 1, 1, 1, 2) | ||
self.pushButton_removeSourceImage = QtWidgets.QPushButton(self.widget) | ||
self.pushButton_removeSourceImage.setObjectName("pushButton_removeSourceImage") | ||
self.gridLayout_3.addWidget(self.pushButton_removeSourceImage, 0, 1, 1, 1) | ||
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) | ||
self.gridLayout_3.addItem(spacerItem1, 0, 3, 1, 1) | ||
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) | ||
self.gridLayout_3.addItem(spacerItem2, 0, 4, 1, 1) | ||
self.gridLayout_4.addWidget(self.widget, 1, 0, 1, 2) | ||
self.textBrowser_logConsole = QtWidgets.QTextBrowser(FaceRecognitionWidget) | ||
self.textBrowser_logConsole.setObjectName("textBrowser_logConsole") | ||
self.gridLayout_4.addWidget(self.textBrowser_logConsole, 2, 0, 1, 2) | ||
|
||
self.retranslateUi(FaceRecognitionWidget) | ||
QtCore.QMetaObject.connectSlotsByName(FaceRecognitionWidget) | ||
|
||
def retranslateUi(self, FaceRecognitionWidget): | ||
_translate = QtCore.QCoreApplication.translate | ||
FaceRecognitionWidget.setWindowTitle(_translate("FaceRecognitionWidget", "Form")) | ||
self.pushButton_selectSourceImage.setText(_translate("FaceRecognitionWidget", "Select")) | ||
self.pushButton_startDbSearch.setText(_translate("FaceRecognitionWidget", "Start Database Search")) | ||
self.label.setText(_translate("FaceRecognitionWidget", "Eşleşme Benzerlik:")) | ||
self.pushButton_removeSourceImage.setText(_translate("FaceRecognitionWidget", "Remove")) | ||
self.textBrowser_logConsole.setHtml(_translate("FaceRecognitionWidget", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" | ||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" | ||
"p, li { white-space: pre-wrap; }\n" | ||
"</style></head><body style=\" font-family:\'Cantarell\'; font-size:11pt; font-weight:400; font-style:normal;\">\n" | ||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">LOG AND RESULTS:</span></p></body></html>")) | ||
|
||
|
||
if __name__ == "__main__": | ||
import sys | ||
app = QtWidgets.QApplication(sys.argv) | ||
FaceRecognitionWidget = QtWidgets.QWidget() | ||
ui = Ui_FaceRecognitionWidget() | ||
ui.setupUi(FaceRecognitionWidget) | ||
FaceRecognitionWidget.show() | ||
sys.exit(app.exec_()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from PyQt5.QtWidgets import * | ||
from PyQt5.QtCore import QThread, pyqtSignal | ||
from PyQt5 import QtGui | ||
|
||
from guilib.FaceRecognitionScreen import Ui_FaceRecognitionWidget | ||
from guilib.html_text_generator.html_draft import gen_error_text,gen_info_text | ||
|
||
from hivelibrary.env import DEFAULT_LOGO_PATH | ||
|
||
|
||
class faceRecognitionBackendThread(QThread): | ||
|
||
statusSignal = pyqtSignal(dict) | ||
|
||
|
||
def __init__(self): | ||
super().__init__() | ||
|
||
|
||
def __runningStatusReturner(self, text:str): | ||
pass | ||
|
||
def __finalyStatusReturner(self,text:str): | ||
pass | ||
|
||
def run(self): | ||
pass | ||
|
||
|
||
|
||
|
||
|
||
class FaceRecognitionWidget(QWidget): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
self.FaceRecognitionPage = Ui_FaceRecognitionWidget() | ||
self.FaceRecognitionPage.setupUi(self) | ||
|
||
self.setWindowTitle("Face Recognition For Database") | ||
|
||
self.LabelSupportedResulation = (320, 320) | ||
|
||
self.showDefaultImage(targetLabel=self.FaceRecognitionPage.label_soruceImageShower) | ||
self.showDefaultImage(targetLabel=self.FaceRecognitionPage.label_detectedImageShower) | ||
|
||
|
||
def showDefaultImage(self, targetLabel): | ||
import cv2 | ||
|
||
image_data = cv2.imread(DEFAULT_LOGO_PATH) | ||
image_data = cv2.resize(image_data, self.LabelSupportedResulation) | ||
image_data = cv2.cvtColor(image_data, cv2.COLOR_BGR2RGB) | ||
img_height, img_width = self.LabelSupportedResulation | ||
image_data = QtGui.QImage(image_data, img_width, img_height,QtGui.QImage.Format.Format_RGB888) | ||
targetLabel.setPixmap(QtGui.QPixmap(image_data)) | ||
|
||
|
||
def addImageInWindow_usingFilePath(self,target_image,target_label): | ||
import cv2 | ||
image_data = cv2.imread(target_image) | ||
image_data = cv2.resize(image_data, self.LabelSupportedResulation) | ||
image_data = cv2.cvtColor(image_data, cv2.COLOR_BGR2RGB) | ||
img_height, img_width = self.LabelSupportedResulation | ||
image_data = QtGui.QImage(image_data, img_width, img_height,QtGui.QImage.Format.Format_RGB888) | ||
target_label.setPixmap(QtGui.QPixmap.fromImage(image_data)) | ||
|
||
|
||
def removeSourceImage(self): | ||
if self.selectedSourceImage != None: | ||
self.selectedSourceImage = None | ||
self.showDefaultImage(targetLabel=self.FaceRecognitionPage.label_soruceImageShower) | ||
self.FaceRecognitionPage.textBrowser_logConsole.append(gen_info_text("Kaynak resim kaldırıldı")) | ||
return | ||
self.FaceRecognitionPage.textBrowser_logConsole.append(gen_error_text("Kaynak resim zaten seçili değil")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>FaceRecognitionWidget</class> | ||
<widget class="QWidget" name="FaceRecognitionWidget"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>1165</width> | ||
<height>763</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout_4"> | ||
<item row="0" column="0"> | ||
<widget class="QWidget" name="widget_sourceImage" native="true"> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>320</width> | ||
<height>320</height> | ||
</size> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label_soruceImageShower"> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>320</width> | ||
<height>320</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string/> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<widget class="QWidget" name="widget_decetedImage" native="true"> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>320</width> | ||
<height>320</height> | ||
</size> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout_2"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label_detectedImageShower"> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>320</width> | ||
<height>320</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string/> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
<item row="1" column="0" colspan="2"> | ||
<widget class="QWidget" name="widget" native="true"> | ||
<layout class="QGridLayout" name="gridLayout_3"> | ||
<item row="1" column="3" colspan="2"> | ||
<widget class="QProgressBar" name="progressBar_benzerlikBari"> | ||
<property name="value"> | ||
<number>0</number> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="2"> | ||
<widget class="QPushButton" name="pushButton_selectSourceImage"> | ||
<property name="text"> | ||
<string>Select</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="0"> | ||
<spacer name="horizontalSpacer_2"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QPushButton" name="pushButton_startDbSearch"> | ||
<property name="text"> | ||
<string>Start Database Search</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="1" colspan="2"> | ||
<widget class="QLabel" name="label"> | ||
<property name="text"> | ||
<string>Eşleşme Benzerlik:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<widget class="QPushButton" name="pushButton_removeSourceImage"> | ||
<property name="text"> | ||
<string>Remove</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="3"> | ||
<spacer name="horizontalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item row="0" column="4"> | ||
<spacer name="horizontalSpacer_3"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
<item row="2" column="0" colspan="2"> | ||
<widget class="QTextBrowser" name="textBrowser_logConsole"> | ||
<property name="html"> | ||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> | ||
<html><head><meta name="qrichtext" content="1" /><style type="text/css"> | ||
p, li { white-space: pre-wrap; } | ||
</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">LOG AND RESULTS:</span></p></body></html></string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from guilib.TcNumberCalculator_controller import TcCalculatorWidget | ||
from guilib.FaceRecognition_controller import FaceRecognitionWidget | ||
from PyQt5.QtWidgets import * | ||
|
||
if __name__ == "__main__": | ||
app = QApplication([]) | ||
win = TcCalculatorWidget() | ||
win = FaceRecognitionWidget() | ||
win.show() | ||
app.exec_() |