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

Method ModSearch_

jni/stasm/asm.cpp:228–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228Shape Mod::ModSearch_( // returns coords of the facial landmarks
229 const Shape& startshape, // in: startshape roughly positioned on face
230 const Image& img, // in: grayscale image (typically just ROI)
231 const Shape* pinnedshape) // in: pinned landmarks, NULL if nothing pinned
232const
233{
234 Image scaledimg; // image scaled to fixed eye-mouth distance
235 const double imgscale = GetPrescale(startshape);
236
237 // TODO This resize is quite slow (cv::INTER_NEAREST is even slower, why?).
238 cv::resize(img, scaledimg,
239 cv::Size(), imgscale, imgscale, cv::INTER_LINEAR);
240
241 TraceShape(startshape * imgscale, scaledimg, 0, -1, "start");
242
243 vector<Image> pyr; // image pyramid (a vec of images, one for each pyr lev)
244 CreatePyr(pyr, scaledimg, N_PYR_LEVS);
245
246 Shape shape(startshape * imgscale * GetPyrScale(N_PYR_LEVS));
247
248 Shape pinned; // pinnedshape scaled to current pyr lev
249 if (pinnedshape)
250 pinned = *pinnedshape * imgscale * GetPyrScale(N_PYR_LEVS);
251
252 for (int ilev = N_PYR_LEVS-1; ilev >= 0; ilev--)
253 {
254 shape *= PYR_RATIO; // scale shape to this pyr lev
255 pinned *= PYR_RATIO;
256
257 LevSearch_(shape,
258 ilev, pyr[ilev], pinned);
259 }
260 return shape / imgscale;
261}
262
263} // namespace stasm

Callers 2

stasm_search_auto_extFunction · 0.80
stasm_search_pinnedFunction · 0.80

Calls 5

GetPrescaleFunction · 0.85
TraceShapeFunction · 0.85
CreatePyrFunction · 0.85
GetPyrScaleFunction · 0.85
resizeFunction · 0.50

Tested by

no test coverage detected