Graduate

Replace BGR2RGB logic

[server]
uri=ws://13.124.104.70:3000
uri=ws://localhost:3000
[client]
image_size=160
margin=44
\ No newline at end of file
......
......@@ -44,7 +44,7 @@ class Client(tk.Frame):
self.image_size = (image_size, image_size)
# cam에서 MTCNN 적용하는 영역
self.detecting_square = (500, 300)
self.detecting_square = (640, 480)
# 영상 위에 사각형 색상 지정
self.rectangle_color = (0, 0, 255)
......@@ -100,7 +100,9 @@ class Client(tk.Frame):
for (x, y, w, h) in faces:
margin = int(self.margin / 2)
image = frame[y-margin:y+h+margin, x-margin:x+w+margin]
return image, True
# BGR to RGB
converted = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
return converted, True
return [], False
def mainthread(self):
......@@ -112,10 +114,8 @@ class Client(tk.Frame):
y2 = int(self.cam_height / 2 + self.detecting_square[1] / 2)
while getattr(t, "do_run", True):
ret, frame = self.cap.read()
# BGR to RGB
converted = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
# detect face
face, detected = self.detect_face(converted[y1:y2, x1:x2])
face, detected = self.detect_face(frame[y1:y2, x1:x2])
if detected:
self.event_loop.run_until_complete(self.send_face(face))
# 사각형 영역 표시
......
[server]
uri=ws://13.124.104.70:3000
uri=ws://localhost:3000
[register]
taking_time=0.2
image_size=160
......
......@@ -124,7 +124,9 @@ class Register(tk.Frame):
for (x, y, w, h) in faces:
margin = int(self.margin / 2)
image = frame[y-margin:y+h+margin, x-margin:x+w+margin]
return image, True
# BGR to RGB
converted = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
return converted, True
return [], False
def mainthread(self):
......@@ -136,12 +138,8 @@ class Register(tk.Frame):
detected_time = None
while getattr(t, "do_run", True):
ret, frame = self.cap.read()
# model에 이용하기 위해 convert
converted = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
# 사각형 영역만 검사
face, detected = self.detect_face(converted[y1:y2, x1:x2])
face, detected = self.detect_face(frame[y1:y2, x1:x2])
# 얼굴이 인식된 경우 파란색 사각형을 띄움
if detected:
frame = cv2.rectangle(frame, (x1, y1), (x2, y2), (255, 0, 0), 3)
......
[client]
user=admin
password=attendance
host=attendance-system.c4yvip5o6czh.ap-northeast-2.rds.amazonaws.com
user=root
password=1234
host=localhost
database=attendance
charset=utf8
......