Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
417c5578
Commit
417c5578
authored
Jan 03, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added face detection example program
parent
47ec9a66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
CMakeLists.txt
examples/CMakeLists.txt
+1
-0
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