@Override public float classify(final SummedSqTiltAreaTable sat, final float wvNorm, final int x, final int y) { final float response = feature.computeResponse(sat, x, y); return (response < threshold * wvNorm) ? left.classify(sat, wvNorm, x, y) : right.classify(sat, wvNorm, x, y); }
@Override public void updateCaches(StageTreeClassifier cascade) { feature.updateCaches(cascade); left.updateCaches(cascade); right.updateCaches(cascade); } }
@Override public String toString() { return "HaarCascadeDetector[cascade=" + detector.getClassifier().getName() + "]"; }
@Override public HaarFeature create(int x, int y, int dx, int dy, int winWidth, int winHeight) { // haar_x4 if ((x + dx * 4 <= winWidth) && (y + dy <= winHeight)) { return HaarFeature.create(false, x, y, dx * 4, dy, -1, x + dx, y, dx * 2, dy, +2); } return null; } },
private static StageTreeClassifier buildCascade(OCVHaarClassifierNode root) throws IOException { return new StageTreeClassifier(root.width, root.height, root.name, root.hasTiltedFeatures, buildStages(root.stages)); }
/** * Recursively update the caches of all the stages to reflect the current * scale. * * @param s * the stage to update */ private void updateCaches(Stage s) { s.updateCaches(this); if (s.successStage != null) updateCaches(s.successStage); if (s.failureStage != null) updateCaches(s.failureStage); }
private boolean checkForNegativeValueFeatures() { for (int i = 0; i < ensemble.length; i++) { if (checkForNegativeValueFeatures(ensemble[i])) return true; } return false; }
/** * @return The minimum detection window size */ public int getMinSize() { return this.detector.getMinimumDetectionSize(); }
/** * @return The maximum detection window size */ public int getMaxSize() { return this.detector.getMaximumDetectionSize(); }
/** * @see Detector#getScaleFactor() * @return The detector scale factor */ public double getScaleFactor() { return detector.getScaleFactor(); }
/** * Set the detector scale factor * * @see Detector#setScaleFactor(float) * * @param scaleFactor * the scale factor */ public void setScale(float scaleFactor) { this.detector.setScaleFactor(scaleFactor); }
@Override public HaarFeature create(int x, int y, int dx, int dy, int winWidth, int winHeight) { if ((x + dx * 3 <= winWidth) && (y + dy * 3 <= winHeight)) { return HaarFeature.create(false, x, y, dx * 3, dy * 3, -1, x + dx, y + dy, dx, dy, +9); } return null; } },
@Override public float classify(final SummedSqTiltAreaTable sat, final float wvNorm, final int x, final int y) { final float response = feature.computeResponse(sat, x, y); return (response < threshold * wvNorm) ? left.classify(sat, wvNorm, x, y) : right.classify(sat, wvNorm, x, y); }
private static StageTreeClassifier buildCascade(OCVHaarClassifierNode root) throws IOException { return new StageTreeClassifier(root.width, root.height, root.name, root.hasTiltedFeatures, buildStages(root.stages)); }
@Override public void updateCaches(StageTreeClassifier cascade) { feature.updateCaches(cascade); left.updateCaches(cascade); right.updateCaches(cascade); } }
private boolean checkForNegativeValueFeatures() { for (int i = 0; i < ensemble.length; i++) { if (checkForNegativeValueFeatures(ensemble[i])) return true; } return false; }
@Override public HaarFeature create(int x, int y, int dx, int dy, int winWidth, int winHeight) { // haar_x3 if ((x + dx * 3 <= winWidth) && (y + dy <= winHeight)) { return HaarFeature.create(false, x, y, dx * 3, dy, -1, x + dx, y, dx, dy, +3); } return null; } },
private boolean checkForNegativeValueFeatures(Classifier classifier) { if (classifier instanceof ValueClassifier) { if (((ValueClassifier) classifier).value < 0) return true; } else { if (checkForNegativeValueFeatures(((HaarFeatureClassifier) classifier).left)) return true; if (checkForNegativeValueFeatures(((HaarFeatureClassifier) classifier).right)) return true; } return false; }
@Override public HaarFeature create(int x, int y, int dx, int dy, int winWidth, int winHeight) { // haar_x3 if ((x + dx * 3 <= winWidth) && (y + dy <= winHeight)) { return HaarFeature.create(false, x, y, dx * 3, dy, -1, x + dx, y, dx, dy, +3); } return null; } },
@Override public HaarFeature create(int x, int y, int dx, int dy, int winWidth, int winHeight) { // haar_x2 if ((x + dx * 2 <= winWidth) && (y + dy <= winHeight)) { return HaarFeature.create(false, x, y, dx * 2, dy, -1, x + dx, y, dx, dy, +2); } return null; } },