Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
417c5578
Commit
417c5578
authored
Jan 02, 2014
by
Davis King
Browse files
Added face detection example program
parent
47ec9a66
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
examples/CMakeLists.txt
examples/CMakeLists.txt
+1
-0
examples/face_detection_ex.cpp
examples/face_detection_ex.cpp
+47
-0
No files found.
examples/CMakeLists.txt
View file @
417c5578
...
@@ -32,6 +32,7 @@ add_example(config_reader_ex)
...
@@ -32,6 +32,7 @@ add_example(config_reader_ex)
add_example
(
custom_trainer_ex
)
add_example
(
custom_trainer_ex
)
add_example
(
dir_nav_ex
)
add_example
(
dir_nav_ex
)
add_example
(
empirical_kernel_map_ex
)
add_example
(
empirical_kernel_map_ex
)
add_example
(
face_detection_ex
)
add_example
(
fhog_ex
)
add_example
(
fhog_ex
)
add_example
(
fhog_object_detector_ex
)
add_example
(
fhog_object_detector_ex
)
add_example
(
file_to_code_ex
)
add_example
(
file_to_code_ex
)
...
...
examples/face_detection_ex.cpp
0 → 100644
View file @
417c5578
// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
/*
*/
#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/gui_widgets.h>
#include <dlib/image_io.h>
#include <iostream>
using
namespace
dlib
;
using
namespace
std
;
// ----------------------------------------------------------------------------------------
int
main
(
int
argc
,
char
**
argv
)
{
try
{
frontal_face_detector
detector
=
get_frontal_face_detector
();
image_window
win
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
array2d
<
unsigned
char
>
img
;
load_image
(
img
,
argv
[
i
]);
pyramid_up
(
img
);
std
::
vector
<
rectangle
>
dets
=
detector
(
img
);
cout
<<
"number of faces detected: "
<<
dets
.
size
()
<<
endl
;
win
.
clear_overlay
();
win
.
set_image
(
img
);
win
.
add_overlay
(
dets
,
rgb_pixel
(
255
,
0
,
0
));
// Pause until the user hits the enter key
cin
.
get
();
}
}
catch
(
exception
&
e
)
{
cout
<<
"
\n
exception thrown!"
<<
endl
;
cout
<<
e
.
what
()
<<
endl
;
}
}
// ----------------------------------------------------------------------------------------
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment