| 295 | } |
| 296 | |
| 297 | Shape ConvertShape( // return shape with nlandmarks, return no rows if can't |
| 298 | const Shape& shape, // in |
| 299 | int nlandmarks) // in: shape.rows=no change, 17=shape17, anything else return no rows |
| 300 | // if shape.rows=77, treat specially: |
| 301 | // 77=nochange, 76=muct76, 68=xm2vts, 22=ar, 20=bioid, 17=shape17 |
| 302 | { |
| 303 | Shape newshape; |
| 304 | if (nlandmarks == shape.rows) |
| 305 | newshape = shape.clone(); |
| 306 | else if (nlandmarks == 17) |
| 307 | newshape = Shape17OrEmpty(shape); |
| 308 | else if (shape.rows == 76) // MUCT 76 |
| 309 | { |
| 310 | switch (nlandmarks) |
| 311 | { |
| 312 | case 68: |
| 313 | newshape = DimKeep(shape.clone(), 68, 2); // MUCT 68 and XM2VTS |
| 314 | break; |
| 315 | default: |
| 316 | break; |
| 317 | } |
| 318 | } |
| 319 | else if (shape.rows == 77) // MUCT 77 (Stasm version 4) |
| 320 | { |
| 321 | switch (nlandmarks) |
| 322 | { |
| 323 | case 20: |
| 324 | newshape = Shape77As20(shape); // BioID |
| 325 | break; |
| 326 | case 22: |
| 327 | newshape = Shape77As22(shape); // AR |
| 328 | break; |
| 329 | case 68: |
| 330 | newshape = Shape77As68(shape); // MUCT 68 and XM2VTS |
| 331 | break; |
| 332 | case 76: |
| 333 | newshape = Shape77As76(shape); // MUCT 76 (Stasm version 3) |
| 334 | break; |
| 335 | default: |
| 336 | break; |
| 337 | } |
| 338 | } |
| 339 | CV_Assert(newshape.rows == nlandmarks || newshape.rows == 0); |
| 340 | return newshape; |
| 341 | } |
| 342 | |
| 343 | } // namespace stasm |
no test coverage detected