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

Function MouthSearchRect

jni/stasm/eyedet.cpp:146–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146static Rect MouthSearchRect( // will search for mouth in this rectangle
147 const Rect& facerect, // in: the detected face rectangle
148 EYAW eyaw, // in
149 int ileft_best, // in: index of best left eye, -1 if none
150 int iright_best, // in: index of best right eye, -1 if none
151 const vec_Rect& leyes, // in: left eyes found by eye detector
152 const vec_Rect& reyes) // in: right eyes found by eye detector
153{
154 Rect rect = facerect;
155
156 int ixshift, iyshift;
157 MouthRectShift(ixshift, iyshift,
158 eyaw, facerect.width, facerect.height,
159 ileft_best, iright_best, leyes, reyes);
160
161 rect.x += cvRound(.2 * facerect.width) + ixshift;
162
163 rect.width = MAX(1, cvRound(.6 * facerect.width));
164 rect.height = cvRound(.42 * facerect.height);
165
166 switch (eyaw)
167 {
168 case EYAW00: // frontal model
169 rect.y += cvRound(.64 * facerect.height);
170 break;
171 case EYAW_45: // left facing three-quarter model
172 rect.y += cvRound(.55 * facerect.height);
173 break;
174 case EYAW_22: // left facing three-quarter model
175 rect.y += cvRound(.55 * facerect.height);
176 break;
177 case EYAW22: // right facing three-quarter model
178 rect.y += cvRound(.55 * facerect.height);
179 break;
180 case EYAW45: // right facing three-quarter model
181 rect.y += cvRound(.55 * facerect.height);
182 break;
183 default:
184 Err("MouthSearchRect: Invalid eyaw %d", eyaw);
185 break;
186 }
187 rect.y += iyshift;
188 rect.width = MAX(0, rect.width);
189 rect.height = MAX(0, rect.height);
190 return rect;
191}
192
193bool NeedEyes( // true if we need the eye detectors for the given mods
194 const vec_Mod& mods) // in: the ASM model(s)

Callers 2

DrawMouthsFunction · 0.85
DetectEyesAndMouthFunction · 0.85

Calls 2

MouthRectShiftFunction · 0.85
ErrFunction · 0.85

Tested by

no test coverage detected