Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
AI_Face
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
宋柯
AI_Face
Commits
2a0f9fcd
Commit
2a0f9fcd
authored
Jun 30, 2021
by
宋柯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
眉毛
parent
8c372a36
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
4 deletions
+78
-4
f_EyeBrow.cpp
f_EyeBrow.cpp
+0
-0
f_MakeupBase.cpp
f_MakeupBase.cpp
+74
-1
f_MakeupBase.h
f_MakeupBase.h
+4
-3
No files found.
f_EyeBrow.cpp
View file @
2a0f9fcd
This diff is collapsed.
Click to expand it.
f_MakeupBase.cpp
View file @
2a0f9fcd
...
...
@@ -67,6 +67,9 @@ int f_MakeupBaseN(unsigned char* srcData, int width, int height, int stride, int
*ratio: intensity of effect, [0, 100]
*Return: 0-OK,other failed
**************************************************************************/
#include "iostream"
using
namespace
std
;
using
namespace
cv
;
int
f_MakeupBase
(
unsigned
char
*
srcData
,
int
width
,
int
height
,
int
stride
,
int
srcKeyPoints
[
2
*
3
],
unsigned
char
*
mskData
,
int
mWidth
,
int
mHeight
,
int
mStride
,
int
maskKeyPoints
[
2
*
3
],
int
ratio
)
{
int
ret
=
0
;
...
...
@@ -108,8 +111,27 @@ int f_MakeupBase(unsigned char* srcData, int width, int height, int stride, int
tmp2
=
mskData
[
index_x0y1
+
3
]
+
((
disX
*
(
mskData
[
index_x1y1
+
3
]
-
mskData
[
index_x0y1
+
3
]))
>>
14
);
AA
=
tmp1
+
((
disY
*
(
tmp2
-
tmp1
))
>>
14
);
int
pos
=
(
x0
<<
2
)
+
y0
*
mStride
;
// int pos = (x0<<2) + y0 * mStride;
// int k = mskData[pos+3];
// int b = (k * mskData[pos] + (255 - k) * pSrc[0]) / 255;
// int g = (k * mskData[pos+1] + (255 - k) * pSrc[1]) / 255;
// int r = (k * mskData[pos+2] + (255 - k) * pSrc[2]) / 255;
int
k
=
AA
;
// int b;
// int g;
// int r;
// if(k){
// b = AB;
// g = AG;
// r = AR;
// }else{
// b = pSrc[0];
// g = pSrc[1];
// r = pSrc[2];
// }
int
b
=
(
k
*
AB
+
(
255
-
k
)
*
pSrc
[
0
])
/
255
;
int
g
=
(
k
*
AG
+
(
255
-
k
)
*
pSrc
[
1
])
/
255
;
int
r
=
(
k
*
AR
+
(
255
-
k
)
*
pSrc
[
2
])
/
255
;
...
...
@@ -122,6 +144,57 @@ int f_MakeupBase(unsigned char* srcData, int width, int height, int stride, int
}
return
ret
;
};
int
f_MakeupBaseTest
(
cv
::
Mat
&
srcData
,
int
width
,
int
height
,
int
stride
,
int
srcKeyPoints
[
2
*
3
],
Mat
&
mskData
,
int
mWidth
,
int
mHeight
,
int
mStride
,
int
maskKeyPoints
[
2
*
3
],
int
ratio
,
cv
::
Mat
&
maskMat
)
{
// cv::Mat maskTemp;
// maskTemp.create(maskMat.rows,maskMat.cols,CV_8UC3);
int
ret
=
0
;
float
H
[
6
]
=
{
0
};
f_AffinetransformMetrixCompute
((
float
)
maskKeyPoints
[
0
],(
float
)
maskKeyPoints
[
1
],(
float
)
maskKeyPoints
[
2
],(
float
)
maskKeyPoints
[
3
],(
float
)
maskKeyPoints
[
4
],(
float
)
maskKeyPoints
[
5
],
(
float
)
srcKeyPoints
[
0
],
(
float
)
srcKeyPoints
[
1
],
(
float
)
srcKeyPoints
[
2
],
(
float
)
srcKeyPoints
[
3
],
(
float
)
srcKeyPoints
[
4
],
(
float
)
srcKeyPoints
[
5
],
H
);
int
alpha
=
128
*
ratio
/
100
;
int
nalpha
=
128
-
alpha
;
// int AR, AG, AB, AA;
int
x0
,
y0
,
index_x0y0
,
index_x0y1
,
index_x1y0
,
index_x1y1
;
// int disX, disY, tmp1, tmp2;
int
c1
=
0
,
c2
=
0
,
c3
=
0
;
set
<
string
>
s1
;
set
<
string
>
s2
;
for
(
int
j
=
0
;
j
<
height
;
j
++
)
{
for
(
int
i
=
0
;
i
<
width
;
i
++
)
{
c3
++
;
float
cx
=
(
H
[
0
]
*
i
+
H
[
1
]
*
j
+
H
[
2
]);
float
cy
=
(
H
[
3
]
*
i
+
H
[
4
]
*
j
+
H
[
5
]);
if
(
cx
>
0
&&
cx
<
mWidth
-
1
&&
cy
>
0
&&
cy
<
mHeight
-
1
)
{
// circle(srcData,Point(i,j),1,Scalar(0,0,255));
x0
=
(
int
)
CLIP3
(
floor
(
cx
),
0
,
mWidth
-
2
);
y0
=
(
int
)
CLIP3
(
floor
(
cy
),
0
,
mHeight
-
2
);
// circle(mskData,Point(x0,y0),1,Scalar(0,0,255));
s1
.
insert
(
to_string
(
x0
)
+
"_"
+
to_string
(
y0
));
Vec4b
&
vec
=
mskData
.
at
<
Vec4b
>
(
Point
(
x0
,
y0
));
srcData
.
at
<
Vec4b
>
(
Point
(
i
,
j
))
=
vec
;
}
}
}
// cv::imshow("maskMat",maskMat);
cout
<<
c1
<<
endl
;
cout
<<
c2
<<
endl
;
cout
<<
c3
<<
endl
;
cout
<<
s1
.
size
()
<<
endl
;
cout
<<
s2
.
size
()
<<
endl
;
// cv::imshow("maskTemp",maskTemp);
cv
::
imshow
(
"mskData"
,
mskData
);
cv
::
imshow
(
"srcData"
,
srcData
);
cv
::
waitKey
(
0
);
return
ret
;
};
inline
int
ModeSmoothLight
(
int
basePixel
,
int
mixPixel
)
{
int
res
=
0
;
...
...
f_MakeupBase.h
View file @
2a0f9fcd
#ifndef __T_MAKEUP_BASE__
#define __T_MAKEUP_BASE__
#include <opencv2/opencv.hpp>
/*************************************************************************
*Function: Makeup base
*Params:
...
...
@@ -13,11 +13,12 @@
*mWidth: width of mask image
*mHeight: height of mask image
*mStride: Stride of mask image
*maskKeyPoints 3 key points of blush mask.
*maskKeyPoints
��
3 key points of blush mask.
*ratio: intensity of effect, [0, 100]
*Return: 0-OK,other failed
**************************************************************************/
int
f_MakeupBase
(
unsigned
char
*
srcData
,
int
width
,
int
height
,
int
stride
,
int
srcKeyPoints
[
2
*
3
],
unsigned
char
*
mskData
,
int
mWidth
,
int
mHeight
,
int
mStride
,
int
maskKeyPoints
[
2
*
3
],
int
ratio
);
int
f_MakeupBaseTest
(
cv
::
Mat
&
srcData
,
int
width
,
int
height
,
int
stride
,
int
srcKeyPoints
[
2
*
3
],
cv
::
Mat
&
mskData
,
int
mWidth
,
int
mHeight
,
int
mStride
,
int
maskKeyPoints
[
2
*
3
],
int
ratio
,
cv
::
Mat
&
maskMat
);
/*************************************************************************
*Function: f_MakeupBaseShadow
*Params:
...
...
@@ -30,7 +31,7 @@ int f_MakeupBase(unsigned char* srcData, int width, int height, int stride, int
*mWidth: width of mask image
*mHeight: height of mask image
*mStride: Stride of mask image
*maskKeyPoints 4 key points of eyeshadow mask.
*maskKeyPoints
��
4 key points of eyeshadow mask.
*mode: overlay mode.
*ratio: intensity of effect, [0, 100]
*Return: 0-OK,other failed
...
...
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