/** * Helper method to convert a list of {@link TrackedFace}s to * {@link CLMDetectedFace}s. * * @param faces * the {@link TrackedFace}s. * @param image * the image the {@link TrackedFace}s came from. * @return the list of {@link CLMDetectedFace}s */ public static List<CLMDetectedFace> convert(final List<TrackedFace> faces, final FImage image) { final List<CLMDetectedFace> cvt = new ArrayList<CLMDetectedFace>(); for (final TrackedFace f : faces) { cvt.add(new CLMDetectedFace(f, image)); } return cvt; }
if ((m = this.conversionCache.get(f)) == null) m = new CLMDetectedFace(f, img); this.conversionCache.put(f, m);
if ((m = this.conversionCache.get(f)) == null) m = new CLMDetectedFace(f, img); this.conversionCache.put(f, m);
/** * Detect faces in the image using the given rectangles as the seeds from * which to start fitting the model. * * @param image * the image * @param detRects * the seed rectangles * @return the detected faces */ public List<CLMDetectedFace> detectFaces(FImage image, List<Rectangle> detRects) { final List<CLMDetectedFace> faces = new ArrayList<CLMDetectedFace>(); for (final Rectangle f : detRects) { if ((f.width == 0) || (f.height == 0)) { continue; } initShape(f, config.shape, config.referenceShape); config.clm._pdm.calcParams(config.shape, config.clm._plocal, config.clm._pglobl); config.clm.fit(image, config.windowSize, config.nIter, config.clamp, config.fTol); config.clm._pdm.calcShape2D(config.shape, config.clm._plocal, config.clm._pglobl); if (config.fcheck) { if (!config.failureCheck.check(config.clm.getViewIdx(), image, config.shape)) { continue; } } faces.add(new CLMDetectedFace(f, config.shape.copy(), config.clm._pglobl.copy(), config.clm._plocal.copy(), config.clm._visi[config.clm.getViewIdx()].copy(), image)); } return faces; }