@Override public List<DetectedFace> detectFaces(FImage image) { if (histogramEqualize) image.processInplace(new EqualisationProcessor()); final List<Rectangle> rects = detector.detect(image); final List<ObjectIntPair<Rectangle>> filteredRects = groupingFilter.apply(rects); final List<DetectedFace> results = new ArrayList<DetectedFace>(); for (final ObjectIntPair<Rectangle> r : filteredRects) { results.add(new DetectedFace(r.first, image.extractROI(r.first), r.second)); } return results; }
/** * Detect faces in an image * * @param im * the image * @return the detected faces */ public List<Rectangle> detect(final FImage im) { final int w = Math.round(im.width / this._img_scale); final int h = Math.round(im.height / this._img_scale); this.small_img_ = ResizeProcessor.resample(im, w, h).processInplace( new EqualisationProcessor()); List<Rectangle> rects = this.detector.detect(this.small_img_); rects = ObjectIntPair.getFirst(this.grouping.apply(rects)); for (final Rectangle r : rects) { r.scale(this._img_scale); } return rects; }
/** * Detect faces in an image * * @param im * the image * @return the detected faces */ public List<Rectangle> detect(final FImage im) { final int w = Math.round(im.width / this._img_scale); final int h = Math.round(im.height / this._img_scale); this.small_img_ = ResizeProcessor.resample(im, w, h).processInplace( new EqualisationProcessor()); List<Rectangle> rects = this.detector.detect(this.small_img_); rects = ObjectIntPair.getFirst(this.grouping.apply(rects)); for (final Rectangle r : rects) { r.scale(this._img_scale); } return rects; }
image = image.process(new EqualisationProcessor());