private void setupDetector() { this.detector = new Detector(this._cascade, this._scale_factor); this.grouping = new OpenCVGrouping(this._min_neighbours); this.detector.setMinimumDetectionSize(this._min_size); }
/** * @return the underlying Haar cascade. */ public StageTreeClassifier getCascade() { return detector.getClassifier(); }
/** * @return The maximum detection window size */ public int getMaxSize() { return this.detector.getMaximumDetectionSize(); }
@Override public void beforeUpdate(MBFImage frame) { final List<Rectangle> rects = d.detect(frame.flatten()); System.out.println(rects.size()); for (final Rectangle r : rects) frame.drawShape(r, RGBColour.RED); }
/** * Construct with the {@link BuiltInCascade#frontalface_default} cascade and * the given minimum search window size. * * @param minSize * minimum search window size */ public HaarCascadeDetector(int minSize) { this(); this.detector.setMinimumDetectionSize(minSize); }
this.detector = new Detector(cascade); else this.detector = new Detector(cascade, this.detector.getScaleFactor()); } catch (final Exception e) { throw e;
@Override public int hashCode() { int hashCode = HashCodeUtil.SEED; hashCode = HashCodeUtil.hash(hashCode, this.detector.getMinimumDetectionSize()); hashCode = HashCodeUtil.hash(hashCode, this.detector.getScaleFactor()); hashCode = HashCodeUtil.hash(hashCode, this.detector.getClassifier().getName()); hashCode = HashCodeUtil.hash(hashCode, this.groupingFilter); hashCode = HashCodeUtil.hash(hashCode, this.histogramEqualize); return hashCode; }
detectAtScale(sat, startX, stopX, startY, stopY, ystep, windowWidth, windowHeight, results);
/** * Set the maximum detection window size * * @param size * the window size */ public void setMaxSize(int size) { this.detector.setMaximumDetectionSize(size); }
/** * @see Detector#getScaleFactor() * @return The detector scale factor */ public double getScaleFactor() { return detector.getScaleFactor(); }
/** * @return The minimum detection window size */ public int getMinSize() { return this.detector.getMinimumDetectionSize(); }
@Override public void beforeUpdate(MBFImage frame) { final List<Rectangle> rects = d.detect(frame.flatten()); System.out.println(rects.size()); for (final Rectangle r : rects) frame.drawShape(r, RGBColour.RED); }
/** * Set the minimum detection window size * * @param size * the window size */ public void setMinSize(int size) { this.detector.setMinimumDetectionSize(size); }
detectAtScale(sat, startX, stopX, startY, stopY, ystep, windowWidth, windowHeight, results);
private void setupDetector() { this.detector = new Detector(this._cascade, this._scale_factor); this.grouping = new OpenCVGrouping(this._min_neighbours); this.detector.setMinimumDetectionSize(this._min_size); }
@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; }
/** * Construct with the given cascade resource and the given minimum search * window size. See {@link #setCascade(String)} to understand how the * cascade is loaded. * * @param cas * The cascade resource. * @param minSize * minimum search window size. * * @see #setCascade(String) */ public HaarCascadeDetector(String cas, int minSize) { this(cas); this.detector.setMinimumDetectionSize(minSize); }
@Override public String toString() { return "HaarCascadeDetector[cascade=" + detector.getClassifier().getName() + "]"; }
final Detector d = new Detector(classifier); d.setMinimumDetectionSize(100);
/** * 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; }