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-28 16:48:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fef11658bda7dc5440765b9589eadb700e05b00c
fef11658
1 parent
ff9da9be
Update margin method
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
flask/templates/index.html
flask/templates/register.html
flask/templates/index.html
View file @
fef1165
...
...
@@ -117,18 +117,28 @@ function main()
let
msize
=
new
cv
.
Size
(
video
.
width
/
4
,
video
.
height
/
4
);
classifier
.
detectMultiScale
(
dst
,
faces
,
1.1
,
3
,
0
,
msize
);
// draw faces.
console
.
log
(
'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
],
8
);
let
cropped
=
new
cv
.
Mat
();
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
22
,
0
),
Math
.
max
(
face
.
y
-
44
,
0
),
Math
.
min
(
face
.
width
+
44
,
src
.
cols
),
Math
.
min
(
face
.
height
+
66
,
src
.
rows
));
let
margin_x
=
0
;
let
margin_y
=
0
;
if
(
face
.
width
>
face
.
height
)
{
margin_y
=
(
face
.
width
-
face
.
height
)
/
2
;
}
else
{
margin_x
=
(
face
.
height
-
face
.
width
)
/
2
;
}
Math
.
max
(
face
.
width
,
face
.
height
)
Math
.
min
(
face
.
width
,
face
.
height
)
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
margin_x
,
0
),
Math
.
max
(
face
.
y
-
margin_y
,
0
),
Math
.
min
(
face
.
width
+
margin_x
,
src
.
cols
),
Math
.
min
(
face
.
height
+
margin_y
,
src
.
rows
));
cropped
=
src
.
roi
(
rect
);
let
tempCanvas
=
document
.
createElement
(
"canvas"
);
cv
.
imshow
(
tempCanvas
,
cropped
);
console
.
log
(
'b64encode'
);
if
(
tracker
.
register
(
face
.
x
,
face
.
y
,
face
.
width
,
face
.
height
)){
let
b64encoded
=
tempCanvas
.
toDataURL
(
"image/jpeg"
,
1.0
);
b64encoded
=
b64encoded
.
replace
(
'data:image/jpeg;base64,'
,
''
);
...
...
flask/templates/register.html
View file @
fef1165
...
...
@@ -119,14 +119,25 @@ function main()
let
msize
=
new
cv
.
Size
(
video
.
width
/
4
,
video
.
height
/
4
);
classifier
.
detectMultiScale
(
dst
,
faces
,
1.1
,
3
,
0
,
msize
);
// draw faces.
console
.
log
(
'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
],
8
);
let
cropped
=
new
cv
.
Mat
();
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
22
,
0
),
Math
.
max
(
face
.
y
-
44
,
0
),
Math
.
min
(
face
.
width
+
44
,
src
.
cols
),
Math
.
min
(
face
.
height
+
66
,
src
.
rows
));
let
margin_x
=
0
;
let
margin_y
=
0
;
if
(
face
.
width
>
face
.
height
)
{
margin_y
=
(
face
.
width
-
face
.
height
)
/
2
;
}
else
{
margin_x
=
(
face
.
height
-
face
.
width
)
/
2
;
}
Math
.
max
(
face
.
width
,
face
.
height
)
Math
.
min
(
face
.
width
,
face
.
height
)
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
margin_x
,
0
),
Math
.
max
(
face
.
y
-
margin_y
,
0
),
Math
.
min
(
face
.
width
+
margin_x
,
src
.
cols
),
Math
.
min
(
face
.
height
+
margin_y
,
src
.
rows
));
cropped
=
src
.
roi
(
rect
);
let
tempCanvas
=
document
.
createElement
(
"canvas"
);
cv
.
imshow
(
tempCanvas
,
cropped
);
...
...
Please
register
or
login
to post a comment