Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
8d9a3e43
Commit
8d9a3e43
authored
Jun 24, 2017
by
berak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
face: minor cleanup after #1239
parent
8f23155d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
22 deletions
+39
-22
face.hpp
modules/face/include/opencv2/face.hpp
+8
-5
facerec.hpp
modules/face/include/opencv2/face/facerec.hpp
+10
-9
facerec_lbph.cpp
modules/face/samples/facerec_lbph.cpp
+2
-2
facerec_save_load.cpp
modules/face/samples/facerec_save_load.cpp
+3
-3
face_basic.cpp
modules/face/src/face_basic.cpp
+7
-0
lbph_faces.cpp
modules/face/src/lbph_faces.cpp
+6
-0
face_tutorial.markdown
modules/face/tutorials/face_tutorial.markdown
+3
-3
No files found.
modules/face/include/opencv2/face.hpp
View file @
8d9a3e43
...
...
@@ -113,7 +113,7 @@ int num_components = 10;
double threshold = 10.0;
// Then if you want to have a cv::FaceRecognizer with a confidence threshold,
// create the concrete implementation with the appropiate parameters:
Ptr<FaceRecognizer> model =
createEigenFaceRecognizer
(num_components, threshold);
Ptr<FaceRecognizer> model =
EigenFaceRecognizer::create
(num_components, threshold);
@endcode
Sometimes it's impossible to train the model, just to experiment with threshold values. Thanks to
...
...
@@ -148,7 +148,7 @@ FaceRecognizer:
@code
// Create a FaceRecognizer:
Ptr<FaceRecognizer> model =
createEigenFaceRecognizer
();
Ptr<FaceRecognizer> model =
EigenFaceRecognizer::create
();
// And here's how to get its name:
String name = model->name();
@endcode
...
...
@@ -192,7 +192,7 @@ public:
// Create a new Fisherfaces model and retain all available Fisherfaces,
// this is the most common usage of this specific FaceRecognizer:
//
Ptr<FaceRecognizer> model =
createFisherFaceRecognizer
();
Ptr<FaceRecognizer> model =
FisherFaceRecognizer::create
();
@endcode
And finally train it on the given dataset (the face images and labels):
...
...
@@ -223,7 +223,7 @@ public:
// Create a new LBPH model (it can be updated) and use the default parameters,
// this is the most common usage of this specific FaceRecognizer:
//
Ptr<FaceRecognizer> model =
createLBPHFaceRecognizer
();
Ptr<FaceRecognizer> model =
LBPHFaceRecognizer::create
();
// This is the common interface to train all of the available cv::FaceRecognizer
// implementations:
//
...
...
@@ -241,7 +241,7 @@ public:
// with the new features extracted from newImages!
@endcode
Calling update on an Eigenfaces model (see
createEigenFaceRecognizer
), which doesn't support
Calling update on an Eigenfaces model (see
EigenFaceRecognizer::create
), which doesn't support
updating, will throw an error similar to:
@code
...
...
@@ -338,6 +338,9 @@ public:
/** @overload */
virtual
void
read
(
const
FileNode
&
fn
)
=
0
;
/** @overload */
virtual
bool
empty
()
const
=
0
;
/** @brief Sets string info for the specified model's label.
The string info is replaced by the provided value if it was set before for the specified label.
...
...
modules/face/include/opencv2/face/facerec.hpp
View file @
8d9a3e43
...
...
@@ -36,6 +36,7 @@ public:
virtual
void
read
(
const
FileNode
&
fn
);
virtual
void
write
(
FileStorage
&
fs
)
const
;
virtual
bool
empty
()
const
;
using
FaceRecognizer
::
read
;
using
FaceRecognizer
::
write
;
...
...
@@ -72,8 +73,8 @@ public:
### Model internal data:
- num_components see
createEigenFaceRecognizer
.
- threshold see
createEigenFaceRecognizer
.
- num_components see
EigenFaceRecognizer::create
.
- threshold see
EigenFaceRecognizer::create
.
- eigenvalues The eigenvalues for this Principal Component Analysis (ordered descending).
- eigenvectors The eigenvectors for this Principal Component Analysis (ordered by their
eigenvalue).
...
...
@@ -109,8 +110,8 @@ public:
### Model internal data:
- num_components see
createFisherFaceRecognizer
.
- threshold see
createFisherFaceRecognizer
.
- num_components see
FisherFaceRecognizer::create
.
- threshold see
FisherFaceRecognizer::create
.
- eigenvalues The eigenvalues for this Linear Discriminant Analysis (ordered descending).
- eigenvectors The eigenvectors for this Linear Discriminant Analysis (ordered by their
eigenvalue).
...
...
@@ -171,11 +172,11 @@ public:
### Model internal data:
- radius see
createLBPHFaceRecognizer
.
- neighbors see
createLBPHFaceRecognizer
.
- grid_x see
createLBPHFaceRecognizer
.
- grid_y see
createLBPHFaceRecognizer
.
- threshold see
createLBPHFaceRecognizer
.
- radius see
LBPHFaceRecognizer::create
.
- neighbors see
LBPHFaceRecognizer::create
.
- grid_x see
LLBPHFaceRecognizer::create
.
- grid_y see
LBPHFaceRecognizer::create
.
- threshold see
LBPHFaceRecognizer::create
.
- histograms Local Binary Patterns Histograms calculated from the given training data (empty if
none was given).
- labels Labels corresponding to the calculated Local Binary Patterns Histograms.
...
...
modules/face/samples/facerec_lbph.cpp
View file @
8d9a3e43
...
...
@@ -97,11 +97,11 @@ int main(int argc, const char *argv[]) {
// So if you want a LBPH FaceRecognizer using a radius of
// 2 and 16 neighbors, call the factory method with:
//
// cv::
createLBPHFaceRecognizer
(2, 16);
// cv::
face::LBPHFaceRecognizer::create
(2, 16);
//
// And if you want a threshold (e.g. 123.0) call it with its default values:
//
// cv::
createLBPHFaceRecognizer
(1,8,8,8,123.0)
// cv::
face::LBPHFaceRecognizer::create
(1,8,8,8,123.0)
//
Ptr
<
LBPHFaceRecognizer
>
model
=
LBPHFaceRecognizer
::
create
();
model
->
train
(
images
,
labels
);
...
...
modules/face/samples/facerec_save_load.cpp
View file @
8d9a3e43
...
...
@@ -115,17 +115,17 @@ int main(int argc, const char *argv[]) {
// 10 principal components (read Eigenfaces), then call
// the factory method like this:
//
// cv::
createEigenFaceRecognizer
(10);
// cv::
face::EigenFaceRecognizer::create
(10);
//
// If you want to create a FaceRecognizer with a
// confidence threshold (e.g. 123.0), call it with:
//
// cv::
createEigenFaceRecognizer
(10, 123.0);
// cv::
face::EigenFaceRecognizer::create
(10, 123.0);
//
// If you want to use _all_ Eigenfaces and have a threshold,
// then call the method like this:
//
// cv::
createEigenFaceRecognizer
(0, 123.0);
// cv::
face::EigenFaceRecognizer::create
(0, 123.0);
//
Ptr
<
EigenFaceRecognizer
>
model0
=
EigenFaceRecognizer
::
create
();
model0
->
train
(
images
,
labels
);
...
...
modules/face/src/face_basic.cpp
View file @
8d9a3e43
...
...
@@ -53,6 +53,7 @@ cv::Mat BasicFaceRecognizer::getMean() const
void
BasicFaceRecognizer
::
read
(
const
FileNode
&
fs
)
{
//read matrices
fs
[
"threshold"
]
>>
_threshold
;
fs
[
"num_components"
]
>>
_num_components
;
fs
[
"mean"
]
>>
_mean
;
fs
[
"eigenvalues"
]
>>
_eigenvalues
;
...
...
@@ -76,6 +77,7 @@ void BasicFaceRecognizer::read(const FileNode& fs)
void
BasicFaceRecognizer
::
write
(
FileStorage
&
fs
)
const
{
// write matrices
fs
<<
"threshold"
<<
_threshold
;
fs
<<
"num_components"
<<
_num_components
;
fs
<<
"mean"
<<
_mean
;
fs
<<
"eigenvalues"
<<
_eigenvalues
;
...
...
@@ -88,3 +90,8 @@ void BasicFaceRecognizer::write(FileStorage& fs) const
fs
<<
LabelInfo
(
it
->
first
,
it
->
second
);
fs
<<
"]"
;
}
bool
BasicFaceRecognizer
::
empty
()
const
{
return
(
_labels
.
empty
());
}
modules/face/src/lbph_faces.cpp
View file @
8d9a3e43
...
...
@@ -100,6 +100,10 @@ public:
// See FaceRecognizer::save.
void
write
(
FileStorage
&
fs
)
const
;
bool
empty
()
const
{
return
(
_labels
.
empty
());
}
CV_IMPL_PROPERTY
(
int
,
GridX
,
_grid_x
)
CV_IMPL_PROPERTY
(
int
,
GridY
,
_grid_y
)
CV_IMPL_PROPERTY
(
int
,
Radius
,
_radius
)
...
...
@@ -111,6 +115,7 @@ public:
void
LBPH
::
read
(
const
FileNode
&
fs
)
{
fs
[
"threshold"
]
>>
_threshold
;
fs
[
"radius"
]
>>
_radius
;
fs
[
"neighbors"
]
>>
_neighbors
;
fs
[
"grid_x"
]
>>
_grid_x
;
...
...
@@ -133,6 +138,7 @@ void LBPH::read(const FileNode& fs) {
// See FaceRecognizer::save.
void
LBPH
::
write
(
FileStorage
&
fs
)
const
{
fs
<<
"threshold"
<<
_threshold
;
fs
<<
"radius"
<<
_radius
;
fs
<<
"neighbors"
<<
_neighbors
;
fs
<<
"grid_x"
<<
_grid_x
;
...
...
modules/face/tutorials/face_tutorial.markdown
View file @
8d9a3e43
...
...
@@ -23,9 +23,9 @@ publications, because a lot of people asked for.
The currently available algorithms are:
-
Eigenfaces (see
createEigenFaceRecognizer
)
-
Fisherfaces (see
createFisherFaceRecognizer
)
-
Local Binary Patterns Histograms (see
createLBPHFaceRecognizer
)
-
Eigenfaces (see
EigenFaceRecognizer::create
)
-
Fisherfaces (see
FisherFaceRecognizer::create
)
-
Local Binary Patterns Histograms (see
LBPHFaceRecognizer::create
)
You don't need to copy and paste the source code examples from this page, because they are available
in the src folder coming with this documentation. If you have built OpenCV with the samples turned
...
...
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