Skip to content

Commit

Permalink
refactor: refactoring code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziad-Muhammed committed Oct 8, 2022
1 parent bb31068 commit cb8bef2
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 30 deletions.
7 changes: 3 additions & 4 deletions FrontApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import localisation.detect as detect
from NewSegmentation.segment import segmentChars
from recognition.KNN import predictChars, classify_image_arrays
from integeration.client import endPoint
from localisation.core.functions import load_model
import os
import numpy as np
Expand All @@ -32,7 +31,7 @@ def __init__(self):
# Load Screen
uic.loadUi('frontapp.ui', self)
# logo of window
self.setWindowIcon(QIcon('logo.ico'))
self.setWindowIcon(QIcon('media/logo.ico'))
# Button
self.findChild(QPushButton, "startButton").clicked.connect(self.Run)
# Get Input from each field
Expand Down Expand Up @@ -100,7 +99,7 @@ def Run(self):
self.textbox_values[idx].setText(self.labels[idx])
except Exception:
continue
self.findChild(QLabel, "endpoint").setText(endPoint(chars2))
self.findChild(QLabel, "endpoint").setText("Access Denied!")
while (not btn_pushed):
QtCore.QCoreApplication.processEvents()
self.finish()
Expand Down Expand Up @@ -185,7 +184,7 @@ def __init__(self):
super(QSplashScreen, self).__init__()
uic.loadUi("loading.ui", self)
self.setWindowFlag(Qt.FramelessWindowHint)
pixmap = QPixmap("IC.png")
pixmap = QPixmap("media/IC.png")
self.setPixmap(pixmap)

self.show()
Expand Down
Binary file removed IIC-Desktop.lnk
Binary file not shown.
Binary file removed IIC-Labeling-Tool.lnk
Binary file not shown.
4 changes: 2 additions & 2 deletions LabellingApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self):
# Load Screen
uic.loadUi('labellingapp2.ui', self)
# logo of window
self.setWindowIcon(QIcon('logo.ico'))
self.setWindowIcon(QIcon('media/logo.ico'))
# Button
self.findChild(QPushButton, "startButton").clicked.connect(self.Run)
# Get Input from each field
Expand Down Expand Up @@ -163,7 +163,7 @@ def __init__(self):
super(QSplashScreen, self).__init__()
uic.loadUi("loading.ui", self)
self.setWindowFlag(Qt.FramelessWindowHint)
pixmap = QPixmap("IC.png")
pixmap = QPixmap("media/IC.png")
self.setPixmap(pixmap)

self.show()
Expand Down
12 changes: 0 additions & 12 deletions integeration/main.py

This file was deleted.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
4 changes: 2 additions & 2 deletions streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self):
self.clean_directory("./detections")
uic.loadUi('stream.ui', self)
# logo of window
self.setWindowIcon(QIcon('logo.ico'))
self.setWindowIcon(QIcon('media/logo.ico'))
self.plate_img = self.findChild(QLabel, "plateImg")
self.green_img = self.findChild(QLabel, "greenImg")
self.green_img.hide()
Expand Down Expand Up @@ -243,7 +243,7 @@ def __init__(self):
super(QSplashScreen, self).__init__()
uic.loadUi("loading.ui", self)
self.setWindowFlag(Qt.FramelessWindowHint)
pixmap = QPixmap("IC.png")
pixmap = QPixmap("media/IC.png")
self.setPixmap(pixmap)

self.show()
Expand Down
17 changes: 7 additions & 10 deletions temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
# from detect import crop_one
sys.path.insert(0, './localisation')
path = './localisation/data/images/1.png'
url = "./localisation/data/videos/2.mp4"
url = "./localisation/data/videos/wp2.mov"
from localisation import detect
from segmentation.segmentation import segmentCharacters
from recognition.KNN import predictChars, classify_image_arrays
from integeration.client import endPoint
from localisation.core.functions import load_model
import os
import numpy as np
Expand All @@ -32,16 +31,16 @@ def __init__(self):
# Load Screen
self.clean_directory("./green_boxes")
self.clean_directory("./detections")
uic.loadUi('stream.ui', self)
uic.loadUi('temp.ui', self)
# logo of window
self.setWindowIcon(QIcon('logo.ico'))
self.setWindowIcon(QIcon('media/logo.ico'))
self.plate_img = self.findChild(QLabel, "plateImg")
self.green_img = self.findChild(QLabel, "greenImg")
self.green_img.hide()
self.endpoint = self.findChild(QLabel, "endpoint")
self.Lp = self.findChild(QLabel, "LP")
self.stream = self.findChild(QLabel, "streaming")
# self.capturebtn = self.findChild(QPushButton, "capture").clicked.connect(VideoThread.captureImg)
self.capturebtn = self.findChild(QPushButton, "capture").clicked.connect(VideoThread.captureImg)
self.findChild(QPushButton, "capture").clicked.connect(self.Run)
# self.findChild(QPushButton, "close").clicked.connect(self.shutDown)
self.findChild(QPushButton, "PushStream").clicked.connect(self.streamingVideo)
Expand Down Expand Up @@ -96,24 +95,22 @@ def Run(self):
self.textbox_values[idx].setText(self.labels[idx])
except Exception:
continue
self.findChild(QLabel, "endpoint").setText(endPoint(chars2))
self.findChild(QLabel, "endpoint").setText("Access granted!")
while (not btn_pushed):
QtCore.QCoreApplication.processEvents()
except Exception:
print("Error")
self.finish()

def finish(self):
self.main_img.clear()
self.plate_img.clear()
self.green_img.clear()
self.Lp.clear()
self.endpoint.clear()
self.main_img.setAlignment(QtCore.Qt.AlignCenter)
self.clean_directory("./green_boxes")
self.clean_directory("./detections")
self.clean_directory("./outputs/1")

self.clean_directory("./localisation/data/images")

def clean_directory(self, path):
files = glob.glob(f'{path}/*')
Expand Down Expand Up @@ -244,7 +241,7 @@ def __init__(self):
super(QSplashScreen, self).__init__()
uic.loadUi("loading.ui", self)
self.setWindowFlag(Qt.FramelessWindowHint)
pixmap = QPixmap("IC.png")
pixmap = QPixmap("media/IC.png")
self.setPixmap(pixmap)

self.show()
Expand Down

0 comments on commit cb8bef2

Please sign in to comment.