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
4df17e67
Commit
4df17e67
authored
May 30, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2069 from tegusi:landmark_fix
parents
ffd13f92
5101dcc4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
21 deletions
+17
-21
facemark.hpp
modules/face/include/opencv2/face/facemark.hpp
+2
-2
facemarkAAM.hpp
modules/face/include/opencv2/face/facemarkAAM.hpp
+1
-1
face_alignmentimpl.hpp
modules/face/src/face_alignmentimpl.hpp
+1
-1
facemarkAAM.cpp
modules/face/src/facemarkAAM.cpp
+6
-8
facemarkLBF.cpp
modules/face/src/facemarkLBF.cpp
+4
-6
getlandmarks.cpp
modules/face/src/getlandmarks.cpp
+3
-3
No files found.
modules/face/include/opencv2/face/facemark.hpp
View file @
4df17e67
...
...
@@ -74,8 +74,8 @@ public:
@endcode
*/
CV_WRAP
virtual
bool
fit
(
InputArray
image
,
InputArray
faces
,
OutputArrayOfArrays
landmarks
)
=
0
;
const
std
::
vector
<
Rect
>&
faces
,
CV_OUT
std
::
vector
<
std
::
vector
<
Point2f
>
>&
landmarks
)
=
0
;
};
/* Facemark*/
...
...
modules/face/include/opencv2/face/facemarkAAM.hpp
View file @
4df17e67
...
...
@@ -146,7 +146,7 @@ public:
};
//! overload with additional Config structures
virtual
bool
fitConfig
(
InputArray
image
,
InputArray
roi
,
OutputArrayOfArrays
_landmarks
,
const
std
::
vector
<
Config
>
&
runtime_params
)
=
0
;
virtual
bool
fitConfig
(
InputArray
image
,
const
std
::
vector
<
Rect
>&
roi
,
std
::
vector
<
std
::
vector
<
Point2f
>
>&
_landmarks
,
const
std
::
vector
<
Config
>
&
runtime_params
)
=
0
;
//! initializer
...
...
modules/face/src/face_alignmentimpl.hpp
View file @
4df17e67
...
...
@@ -73,7 +73,7 @@ public:
void
loadModel
(
String
fs
)
CV_OVERRIDE
;
bool
setFaceDetector
(
FN_FaceDetector
f
,
void
*
userdata
)
CV_OVERRIDE
;
bool
getFaces
(
InputArray
image
,
OutputArray
faces
)
CV_OVERRIDE
;
bool
fit
(
InputArray
image
,
InputArray
faces
,
OutputArrayOfArrays
landmarks
)
CV_OVERRIDE
;
bool
fit
(
InputArray
image
,
const
std
::
vector
<
Rect
>&
faces
,
CV_OUT
std
::
vector
<
std
::
vector
<
Point2f
>
>&
landmarks
)
CV_OVERRIDE
;
void
training
(
String
imageList
,
String
groundTruth
);
bool
training
(
vector
<
Mat
>&
images
,
vector
<
vector
<
Point2f
>
>&
landmarks
,
string
filename
,
Size
scale
,
string
modelFilename
)
CV_OVERRIDE
;
// Destructor for the class.
...
...
modules/face/src/facemarkAAM.cpp
View file @
4df17e67
...
...
@@ -103,12 +103,11 @@ public:
bool
getData
(
void
*
items
)
CV_OVERRIDE
;
bool
fitConfig
(
InputArray
image
,
InputArray
roi
,
OutputArrayOfArrays
_landmarks
,
const
std
::
vector
<
Config
>
&
runtime_params
)
CV_OVERRIDE
;
bool
fitConfig
(
InputArray
image
,
const
std
::
vector
<
Rect
>&
roi
,
std
::
vector
<
std
::
vector
<
Point2f
>
>&
_landmarks
,
const
std
::
vector
<
Config
>
&
runtime_params
)
CV_OVERRIDE
;
protected
:
bool
fit
(
InputArray
image
,
InputArray
faces
,
OutputArrayOfArrays
landmarks
)
CV_OVERRIDE
;
//bool fit( InputArray image, InputArray faces, InputOutputArray landmarks, void * runtime_params);//!< from many ROIs
bool
fit
(
InputArray
image
,
const
std
::
vector
<
Rect
>&
faces
,
CV_OUT
std
::
vector
<
std
::
vector
<
Point2f
>
>&
landmarks
)
CV_OVERRIDE
;
bool
fitImpl
(
const
Mat
image
,
std
::
vector
<
Point2f
>&
landmarks
,
const
Mat
R
,
const
Point2f
T
,
const
float
scale
,
const
int
sclIdx
=
0
);
bool
addTrainingSample
(
InputArray
image
,
InputArray
landmarks
)
CV_OVERRIDE
;
...
...
@@ -323,19 +322,18 @@ void FacemarkAAMImpl::training(void* parameters){
if
(
params
.
verbose
)
printf
(
"Training is completed
\n
"
);
}
bool
FacemarkAAMImpl
::
fit
(
InputArray
image
,
InputArray
roi
,
OutputArrayOfArrays
_landmarks
)
bool
FacemarkAAMImpl
::
fit
(
InputArray
image
,
const
std
::
vector
<
Rect
>&
roi
,
CV_OUT
std
::
vector
<
std
::
vector
<
Point2f
>
>&
_landmarks
)
{
std
::
vector
<
Config
>
config
;
// empty
return
fitConfig
(
image
,
roi
,
_landmarks
,
config
);
}
bool
FacemarkAAMImpl
::
fitConfig
(
InputArray
image
,
InputArray
roi
,
OutputArrayOfArrays
_landmarks
,
const
std
::
vector
<
Config
>
&
configs
)
bool
FacemarkAAMImpl
::
fitConfig
(
InputArray
image
,
const
std
::
vector
<
Rect
>&
roi
,
std
::
vector
<
std
::
vector
<
Point2f
>
>&
_landmarks
,
const
std
::
vector
<
Config
>
&
configs
)
{
std
::
vector
<
Rect
>
&
faces
=
*
(
std
::
vector
<
Rect
>
*
)
roi
.
getObj
()
;
const
std
::
vector
<
Rect
>
&
faces
=
roi
;
if
(
faces
.
size
()
<
1
)
return
false
;
std
::
vector
<
std
::
vector
<
Point2f
>
>
&
landmarks
=
*
(
std
::
vector
<
std
::
vector
<
Point2f
>
>*
)
_landmarks
.
getObj
();
std
::
vector
<
std
::
vector
<
Point2f
>
>
&
landmarks
=
_landmarks
;
landmarks
.
resize
(
faces
.
size
());
Mat
img
=
image
.
getMat
();
...
...
modules/face/src/facemarkLBF.cpp
View file @
4df17e67
...
...
@@ -115,7 +115,7 @@ public:
protected
:
bool
fit
(
InputArray
image
,
InputArray
faces
,
OutputArrayOfArrays
landmarks
)
CV_OVERRIDE
;
//!< from many ROIs
bool
fit
(
InputArray
image
,
const
std
::
vector
<
Rect
>
&
faces
,
std
::
vector
<
std
::
vector
<
Point2f
>
>
&
landmarks
)
CV_OVERRIDE
;
//!< from many ROIs
bool
fitImpl
(
const
Mat
image
,
std
::
vector
<
Point2f
>
&
landmarks
);
//!< from a face
bool
addTrainingSample
(
InputArray
image
,
InputArray
landmarks
)
CV_OVERRIDE
;
...
...
@@ -370,14 +370,12 @@ void FacemarkLBFImpl::training(void* parameters){
isModelTrained
=
true
;
}
bool
FacemarkLBFImpl
::
fit
(
InputArray
image
,
InputArray
roi
,
OutputArrayOfArrays
_landmarks
)
bool
FacemarkLBFImpl
::
fit
(
InputArray
image
,
const
std
::
vector
<
Rect
>
&
roi
,
CV_OUT
std
::
vector
<
std
::
vector
<
Point2f
>
>
&
_landmarks
)
{
// FIXIT
std
::
vector
<
Rect
>
&
faces
=
*
(
std
::
vector
<
Rect
>
*
)
roi
.
getObj
();
const
std
::
vector
<
Rect
>
&
faces
=
roi
;
if
(
faces
.
empty
())
return
false
;
std
::
vector
<
std
::
vector
<
Point2f
>
>
&
landmarks
=
*
(
std
::
vector
<
std
::
vector
<
Point2f
>
>*
)
_landmarks
.
getObj
();
std
::
vector
<
std
::
vector
<
Point2f
>
>
&
landmarks
=
_landmarks
;
landmarks
.
resize
(
faces
.
size
());
...
...
modules/face/src/getlandmarks.cpp
View file @
4df17e67
...
...
@@ -168,15 +168,15 @@ void FacemarkKazemiImpl :: loadModel(String filename){
f
.
close
();
isModelLoaded
=
true
;
}
bool
FacemarkKazemiImpl
::
fit
(
InputArray
img
,
InputArray
roi
,
OutputArrayOfArrays
landmarks
){
bool
FacemarkKazemiImpl
::
fit
(
InputArray
img
,
const
std
::
vector
<
Rect
>&
roi
,
CV_OUT
std
::
vector
<
std
::
vector
<
Point2f
>
>&
landmarks
){
if
(
!
isModelLoaded
){
String
error_message
=
"No model loaded. Aborting...."
;
CV_Error
(
Error
::
StsBadArg
,
error_message
);
return
false
;
}
Mat
image
=
img
.
getMat
();
std
::
vector
<
Rect
>
&
faces
=
*
(
std
::
vector
<
Rect
>*
)
roi
.
getObj
()
;
std
::
vector
<
std
::
vector
<
Point2f
>
>
&
shapes
=
*
(
std
::
vector
<
std
::
vector
<
Point2f
>
>*
)
landmarks
.
getObj
()
;
const
std
::
vector
<
Rect
>
&
faces
=
roi
;
std
::
vector
<
std
::
vector
<
Point2f
>
>
&
shapes
=
landmarks
;
shapes
.
resize
(
faces
.
size
());
if
(
image
.
empty
()){
...
...
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