| 239 | } |
| 240 | |
| 241 | int stasm_search_pinned( // call after the user has pinned some points |
| 242 | float* landmarks, // out: x0, y0, x1, y1, ..., caller must allocate |
| 243 | const float* pinned, // in: pinned landmarks (0,0 points not pinned) |
| 244 | const char* image, // in: gray image data, top left corner at 0,0 |
| 245 | int width, // in: image width |
| 246 | int height, // in: image height |
| 247 | const char* imgpath) // in: image path, used only for err msgs and debug |
| 248 | { |
| 249 | int returnval = 1; // assume success |
| 250 | CatchOpenCvErrs(); |
| 251 | try |
| 252 | { |
| 253 | CV_Assert(imgpath && STRNLEN(imgpath, SLEN) < SLEN); |
| 254 | CheckStasmInit(); |
| 255 | |
| 256 | img_g = Image(height, width, (unsigned char*)image); |
| 257 | |
| 258 | const Shape pinnedshape(LandmarksAsShape(pinned)); |
| 259 | |
| 260 | Shape shape; // the shape with landmarks |
| 261 | Image face_roi; // img cropped to startshape area and maybe rotated |
| 262 | Shape pinned_roi; // pinned translated to ROI frame |
| 263 | DetectorParameter detpar_roi; // detpar translated to ROI frame |
| 264 | DetectorParameter detpar; // params returned by pseudo face det, in img frame |
| 265 | |
| 266 | PinnedStartShapeAndRoi(shape, face_roi, detpar_roi, detpar, pinned_roi, |
| 267 | img_g, mods_g, pinnedshape); |
| 268 | |
| 269 | // now working with maybe flipped ROI and start shape in ROI frame |
| 270 | const int imod = ABS(EyawAsModIndex(detpar.eyaw, mods_g)); |
| 271 | |
| 272 | shape = mods_g[imod]->ModSearch_(shape, face_roi, &pinned_roi); // ASM search |
| 273 | |
| 274 | shape = RoundMat(RoiShapeToImgFrame(shape, face_roi, detpar_roi, detpar)); |
| 275 | // now working with non flipped start shape in image frame |
| 276 | ForcePinnedPoints(shape, pinnedshape); // undo above RoundMat on pinned points |
| 277 | ShapeToLandmarks(landmarks, shape); |
| 278 | if (trace_g) |
| 279 | lprintf("\n"); |
| 280 | } |
| 281 | catch(...) |
| 282 | { |
| 283 | returnval = 0; // a call was made to Err or a CV_Assert failed |
| 284 | } |
| 285 | UncatchOpenCvErrs(); |
| 286 | return returnval; |
| 287 | } |
| 288 | |
| 289 | const char* stasm_lasterr(void) // same as LastErr but not in stasm namespace |
| 290 | { |
nothing calls this directly
no test coverage detected