Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
face_recognition
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
se_329_cylicon_valley
face_recognition
Commits
2423dfff
Commit
2423dfff
authored
8 years ago
by
Noah Eigenfeld
Browse files
Options
Downloads
Patches
Plain Diff
Added overlay with control options
parent
3906ed43
No related branches found
Branches containing commit
No related tags found
1 merge request
!3
Added overlay with control options
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
FacialRec.cpp
+15
-4
15 additions, 4 deletions
FacialRec.cpp
with
15 additions
and
4 deletions
FacialRec.cpp
+
15
−
4
View file @
2423dfff
...
@@ -36,7 +36,13 @@ int main() {
...
@@ -36,7 +36,13 @@ int main() {
return
1
;
return
1
;
}
}
imshow
(
"Webcam"
,
frame
);
//show some test text
Mat
frame_with_text
=
frame
.
clone
();
putText
(
frame_with_text
,
"Press Spacebar to take a picture"
,
Point2f
(
110
,
100
),
FONT_HERSHEY_SIMPLEX
,
2.0
,
Scalar
(
255
,
0
,
0
,
0
),
3
);
putText
(
frame_with_text
,
"Press ESC to close the application"
,
Point2f
(
90
,
600
),
FONT_HERSHEY_SIMPLEX
,
2.0
,
Scalar
(
0
,
0
,
255
,
255
),
3
);
imshow
(
"Webcam"
,
frame_with_text
);
key
=
waitKey
(
30
);
key
=
waitKey
(
30
);
if
(
key
==
27
)
{
//escape key pressed: stop program
if
(
key
==
27
)
{
//escape key pressed: stop program
...
@@ -44,18 +50,23 @@ int main() {
...
@@ -44,18 +50,23 @@ int main() {
break
;
break
;
}
}
else
if
(
key
==
' '
)
{
//spacebar pressed: take a picture
else
if
(
key
==
' '
)
{
//spacebar pressed: take a picture
picture
=
frame
;
picture
=
frame
;
key
=
-
1
;
key
=
-
1
;
while
(
true
)
{
while
(
true
)
{
imshow
(
"Webcam"
,
picture
);
Mat
picture_with_text
=
picture
.
clone
();
putText
(
picture_with_text
,
"Press 's' to save"
,
Point2f
(
375
,
100
),
FONT_HERSHEY_SIMPLEX
,
2.0
,
Scalar
(
255
,
0
,
0
,
0
),
3
);
putText
(
picture_with_text
,
"Press ESC/Spacebar to return"
,
Point2f
(
160
,
600
),
FONT_HERSHEY_SIMPLEX
,
2.0
,
Scalar
(
0
,
0
,
255
,
255
),
3
);
imshow
(
"Webcam"
,
picture_with_text
);
key
=
waitKey
(
30
);
key
=
waitKey
(
30
);
if
(
key
==
27
||
key
==
32
)
{
if
(
key
==
27
||
key
==
32
)
{
//spacebar or ESC pressed
cout
<<
"ESC or SPACE pressed. Returning to video..."
<<
endl
;
cout
<<
"ESC or SPACE pressed. Returning to video..."
<<
endl
;
break
;
break
;
}
else
if
(
key
==
115
)
{
}
else
if
(
key
==
115
)
{
//s pressed
bool
maybe
=
imwrite
(
"./testimage.jpg"
,
picture
);
bool
maybe
=
imwrite
(
"./testimage.jpg"
,
picture
);
cout
<<
"s was pressed. saving image "
<<
maybe
<<
endl
;
cout
<<
"s was pressed. saving image "
<<
maybe
<<
endl
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment