Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2014104149
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Graduate
2020-11-22 23:36:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
86d878b09cb9045f5417cb56d2cc079abc5a03d1
86d878b0
1 parent
d75a919a
Replace BGR2RGB logic
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
16 deletions
client/client.cnf
client/client.py
register/register.cnf
register/register.py
server/DB.cnf
client/client.cnf
View file @
86d878b
[server]
uri=ws://
13.124.104.70
:3000
uri=ws://
localhost
:3000
[client]
image_size=160
margin=44
\ No newline at end of file
...
...
client/client.py
View file @
86d878b
...
...
@@ -44,7 +44,7 @@ class Client(tk.Frame):
self
.
image_size
=
(
image_size
,
image_size
)
# cam에서 MTCNN 적용하는 영역
self
.
detecting_square
=
(
500
,
30
0
)
self
.
detecting_square
=
(
640
,
48
0
)
# 영상 위에 사각형 색상 지정
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
))
# 사각형 영역 표시
...
...
register/register.cnf
View file @
86d878b
[server]
uri=ws://
13.124.104.70
:3000
uri=ws://
localhost
:3000
[register]
taking_time=0.2
image_size=160
...
...
register/register.py
View file @
86d878b
...
...
@@ -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
)
...
...
server/DB.cnf
View file @
86d878b
[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
...
...
Please
register
or
login
to post a comment