MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / AlignMeanShapeToBothEyesMouth

Function AlignMeanShapeToBothEyesMouth

jni/stasm/startshape.cpp:85–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83// triangle in the meanshape to this triangle.
84
85static Shape AlignMeanShapeToBothEyesMouth(
86 const DetectorParameter& detpar, // in
87 const Shape& meanshape) // in
88{
89 if (trace_g)
90 lprintf("AlignToBothEyesMouth ");
91
92 CV_Assert(NSIZE(meanshape) > 0 && PointUsed(meanshape, 0));
93 CV_Assert(Valid(detpar.mouthx));
94 CV_Assert(Valid(detpar.lex));
95 CV_Assert(Valid(detpar.rex));
96
97 Shape mean_tri(3, 2), det_tri(3, 2); // triangle of eyes and mouth
98
99 const double x_meanmouth =
100 (meanshape(L_CTopOfTopLip, IX) + meanshape(L_CBotOfBotLip, IX)) / 2.;
101
102 const double y_meanmouth =
103 (meanshape(L_CTopOfTopLip, IY) + meanshape(L_CBotOfBotLip, IY)) / 2.;
104
105 const Shape shape17(Shape17(meanshape));
106
107 mean_tri(0, IX) = shape17(L17_LPupil, IX); // left eye
108 mean_tri(0, IY) = shape17(L17_LPupil, IY);
109 mean_tri(1, IX) = shape17(L17_RPupil, IX); // right eye
110 mean_tri(1, IY) = shape17(L17_RPupil, IY);
111 mean_tri(2, IX) = x_meanmouth; // mouth
112 mean_tri(2, IY) = y_meanmouth;
113
114 det_tri(0, IX) = detpar.lex; // left eye
115 det_tri(0, IY) = detpar.ley;
116 det_tri(1, IX) = detpar.rex; // right eye
117 det_tri(1, IY) = detpar.rey;
118 det_tri(2, IX) = detpar.mouthx; // mouth
119 det_tri(2, IY) = detpar.mouthy;
120
121 return TransformShape(meanshape, AlignmentMat(mean_tri, det_tri));
122}
123
124// return the model meanshape aligned to both eyes (mouth is not avail)
125

Callers 1

EstartEyeMouthFunction · 0.85

Calls 7

lprintfFunction · 0.85
NSIZEFunction · 0.85
PointUsedFunction · 0.85
ValidFunction · 0.85
Shape17Function · 0.85
TransformShapeFunction · 0.85
AlignmentMatFunction · 0.85

Tested by

no test coverage detected