Graduate

Replace BGR2RGB logic

1 [server] 1 [server]
2 -uri=ws://13.124.104.70:3000 2 +uri=ws://localhost:3000
3 [client] 3 [client]
4 image_size=160 4 image_size=160
5 margin=44 5 margin=44
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -44,7 +44,7 @@ class Client(tk.Frame): ...@@ -44,7 +44,7 @@ class Client(tk.Frame):
44 self.image_size = (image_size, image_size) 44 self.image_size = (image_size, image_size)
45 45
46 # cam에서 MTCNN 적용하는 영역 46 # cam에서 MTCNN 적용하는 영역
47 - self.detecting_square = (500, 300) 47 + self.detecting_square = (640, 480)
48 48
49 # 영상 위에 사각형 색상 지정 49 # 영상 위에 사각형 색상 지정
50 self.rectangle_color = (0, 0, 255) 50 self.rectangle_color = (0, 0, 255)
...@@ -100,7 +100,9 @@ class Client(tk.Frame): ...@@ -100,7 +100,9 @@ class Client(tk.Frame):
100 for (x, y, w, h) in faces: 100 for (x, y, w, h) in faces:
101 margin = int(self.margin / 2) 101 margin = int(self.margin / 2)
102 image = frame[y-margin:y+h+margin, x-margin:x+w+margin] 102 image = frame[y-margin:y+h+margin, x-margin:x+w+margin]
103 - return image, True 103 + # BGR to RGB
104 + converted = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
105 + return converted, True
104 return [], False 106 return [], False
105 107
106 def mainthread(self): 108 def mainthread(self):
...@@ -112,10 +114,8 @@ class Client(tk.Frame): ...@@ -112,10 +114,8 @@ class Client(tk.Frame):
112 y2 = int(self.cam_height / 2 + self.detecting_square[1] / 2) 114 y2 = int(self.cam_height / 2 + self.detecting_square[1] / 2)
113 while getattr(t, "do_run", True): 115 while getattr(t, "do_run", True):
114 ret, frame = self.cap.read() 116 ret, frame = self.cap.read()
115 - # BGR to RGB
116 - converted = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
117 # detect face 117 # detect face
118 - face, detected = self.detect_face(converted[y1:y2, x1:x2]) 118 + face, detected = self.detect_face(frame[y1:y2, x1:x2])
119 if detected: 119 if detected:
120 self.event_loop.run_until_complete(self.send_face(face)) 120 self.event_loop.run_until_complete(self.send_face(face))
121 # 사각형 영역 표시 121 # 사각형 영역 표시
......
1 [server] 1 [server]
2 -uri=ws://13.124.104.70:3000 2 +uri=ws://localhost:3000
3 [register] 3 [register]
4 taking_time=0.2 4 taking_time=0.2
5 image_size=160 5 image_size=160
......
...@@ -124,7 +124,9 @@ class Register(tk.Frame): ...@@ -124,7 +124,9 @@ class Register(tk.Frame):
124 for (x, y, w, h) in faces: 124 for (x, y, w, h) in faces:
125 margin = int(self.margin / 2) 125 margin = int(self.margin / 2)
126 image = frame[y-margin:y+h+margin, x-margin:x+w+margin] 126 image = frame[y-margin:y+h+margin, x-margin:x+w+margin]
127 - return image, True 127 + # BGR to RGB
128 + converted = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
129 + return converted, True
128 return [], False 130 return [], False
129 131
130 def mainthread(self): 132 def mainthread(self):
...@@ -136,12 +138,8 @@ class Register(tk.Frame): ...@@ -136,12 +138,8 @@ class Register(tk.Frame):
136 detected_time = None 138 detected_time = None
137 while getattr(t, "do_run", True): 139 while getattr(t, "do_run", True):
138 ret, frame = self.cap.read() 140 ret, frame = self.cap.read()
139 -
140 - # model에 이용하기 위해 convert
141 - converted = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
142 -
143 # 사각형 영역만 검사 141 # 사각형 영역만 검사
144 - face, detected = self.detect_face(converted[y1:y2, x1:x2]) 142 + face, detected = self.detect_face(frame[y1:y2, x1:x2])
145 # 얼굴이 인식된 경우 파란색 사각형을 띄움 143 # 얼굴이 인식된 경우 파란색 사각형을 띄움
146 if detected: 144 if detected:
147 frame = cv2.rectangle(frame, (x1, y1), (x2, y2), (255, 0, 0), 3) 145 frame = cv2.rectangle(frame, (x1, y1), (x2, y2), (255, 0, 0), 3)
......
1 [client] 1 [client]
2 -user=admin 2 +user=root
3 -password=attendance 3 +password=1234
4 -host=attendance-system.c4yvip5o6czh.ap-northeast-2.rds.amazonaws.com 4 +host=localhost
5 database=attendance 5 database=attendance
6 charset=utf8 6 charset=utf8
......