| 83 | // triangle in the meanshape to this triangle. |
| 84 | |
| 85 | static 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 |
no test coverage detected