/** * 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; }