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-26 03:09:04 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5da7139bfa8113e5fd710db3cf845ccdaca927e8
5da7139b
1 parent
871f7693
Resize registered image
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
12 deletions
flask/run.sh
flask/templates/index.html
flask/templates/register.html
flask/run.sh
View file @
5da7139
flask run --host 0.0.0.0
--cert
=
cert.pem --key
=
key.pem
python3 -m flask run --host 0.0.0.0 --port 443
--cert
=
cert.pem --key
=
key.pem
...
...
flask/templates/index.html
View file @
5da7139
...
...
@@ -112,7 +112,9 @@ function processVideo() {
let
point2
=
new
cv
.
Point
(
face
.
x
+
face
.
width
,
face
.
y
+
face
.
height
);
cv
.
rectangle
(
dst
,
point1
,
point2
,
[
255
,
0
,
0
,
255
]);
let
cropped
=
new
cv
.
Mat
();
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
22
,
0
),
Math
.
max
(
face
.
y
-
22
,
0
),
face
.
width
+
22
,
face
.
height
+
22
);
let
margin_x
=
face
.
width
/
5
;
let
margin_y
=
face
.
height
/
5
;
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
margin_x
,
0
),
Math
.
max
(
face
.
y
-
margin_y
,
0
),
face
.
width
+
margin_x
,
face
.
height
+
margin_y
);
cropped
=
src
.
roi
(
rect
);
let
tempCanvas
=
document
.
createElement
(
"canvas"
);
cv
.
imshow
(
tempCanvas
,
cropped
);
...
...
flask/templates/register.html
View file @
5da7139
...
...
@@ -47,32 +47,39 @@ function detect_face()
let
msize
=
new
cv
.
Size
(
120
,
120
);
// detect faces.
classifier
.
detectMultiScale
(
gray
,
faces
,
1.1
,
3
,
0
,
msize
);
if
(
faces
.
size
()
==
0
)
{
alert
(
'얼굴이 인식되지 않았습니다.'
);
}
else
if
(
faces
.
size
()
>
1
)
{
alert
(
'하나의 얼굴만 등록해주세요.'
)
}
// draw faces.
for
(
let
i
=
0
;
i
<
faces
.
size
();
++
i
)
{
let
face
=
faces
.
get
(
i
);
let
point1
=
new
cv
.
Point
(
face
.
x
,
face
.
y
);
let
point2
=
new
cv
.
Point
(
face
.
x
+
face
.
width
,
face
.
y
+
face
.
height
);
cv
.
rectangle
(
dst
,
point1
,
point2
,
[
255
,
0
,
0
,
255
]);
// margin 44
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
22
,
0
),
Math
.
max
(
face
.
y
-
22
,
0
),
face
.
width
+
22
,
face
.
height
+
22
);
let
margin_x
=
face
.
width
/
5
;
let
margin_y
=
face
.
height
/
5
;
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
margin_x
,
0
),
Math
.
max
(
face
.
y
-
margin_y
,
0
),
face
.
width
+
margin_x
,
face
.
height
+
margin_y
);
let
cropped
=
src
.
roi
(
rect
);
cv
.
imshow
(
tempCanvas
,
cropped
);
}
let
preview
=
document
.
getElementById
(
'preview'
);
cv
.
imshow
(
preview
,
dst
);
if
(
faces
.
size
()
==
1
)
{
let
sender
=
document
.
getElementById
(
"sender"
);
sender
.
disabled
=
false
;
}
else
if
(
faces
.
size
()
==
0
)
{
alert
(
'얼굴이 인식되지 않았습니다.'
);
}
else
if
(
dst
.
cols
>
$
(
window
).
width
())
{
alert
(
'하나의 얼굴만 등록해주세요.'
)
let
ratio
=
$
(
window
).
width
()
/
parseFloat
(
dst
.
cols
);
let
dsize
=
new
cv
.
Size
(
dst
.
cols
*
ratio
,
dst
.
rows
*
ratio
);
cv
.
resize
(
dst
,
dst
,
dsize
,
0
,
0
,
cv
.
INTER_AREA
);
}
let
preview
=
document
.
getElementById
(
'preview'
);
cv
.
imshow
(
preview
,
dst
);
}
function
submit
()
...
...
Please
register
or
login
to post a comment