Search in sources :

Example 1 with TldRegion

use of boofcv.alg.tracker.tld.TldRegion in project BoofCV by lessthanoptimal.

the class TldVisualizationPanel method addDetections.

private void addDetections(FastQueue<TldRegion> detections) {
    this.detections.reset();
    for (TldRegion r : detections.toList()) {
        TldRegion a = this.detections.grow();
        a.confidence = r.confidence;
        a.rect.set(r.rect);
    }
}
Also used : TldRegion(boofcv.alg.tracker.tld.TldRegion)

Example 2 with TldRegion

use of boofcv.alg.tracker.tld.TldRegion in project BoofCV by lessthanoptimal.

the class VisualizeTldDetectionApp method printDescriptions.

private void printDescriptions() {
    TldTemplateMatching<T> matching = tracker.getTemplateMatching();
    FastQueue<TldRegion> detected = tracker.getDetection().getLocalMaximums();
    NccFeature t = matching.createDescriptor();
    NccFeature f = matching.createDescriptor();
    matching.computeNccDescriptor(t, target.x0, target.y0, target.x1, target.y1);
    System.out.println("Target:");
    printDescription(t);
    for (int i = 0; i < detected.size; i++) {
        TldRegion r = detected.get(i);
        matching.computeNccDescriptor(f, r.rect.x0, r.rect.y0, r.rect.x1, r.rect.y1);
        System.out.println("Detected:");
        System.out.println("  " + r.rect);
        printDescription(f);
        System.out.println("  NCC score = " + DescriptorDistance.ncc(t, f));
        System.out.println("  Confidence = " + matching.computeConfidence(r.rect));
        System.out.println("  Distance = " + matching.distance(f, matching.getTemplatePositive()));
    }
}
Also used : NccFeature(boofcv.struct.feature.NccFeature) TldRegion(boofcv.alg.tracker.tld.TldRegion)

Example 3 with TldRegion

use of boofcv.alg.tracker.tld.TldRegion in project BoofCV by lessthanoptimal.

the class VisualizeTldDetectionApp method paintComponent.

@Override
protected synchronized void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    g2.drawImage(input, 0, 0, null);
    // FastQueue<TldRegion> detected = tracker.getDetectedTargets();
    FastQueue<TldRegion> detected = tracker.getDetection().getCandidateDetections();
    drawDetections(g2, detected, 0);
    if (tracker.getDetection().isAmbiguous())
        drawDetections(g2, tracker.getDetection().getLocalMaximums(), Color.RED);
    else {
        TldRegion r = tracker.getDetection().getBest();
        if (r != null)
            drawRectangle(g2, r.rect, Color.RED, 3);
    }
    drawRectangle(g2, target, Color.GREEN, 3);
    if (detected.size() != 0) {
    // drawRectangle(g2,target,Color.RED,3);
    }
}
Also used : TldRegion(boofcv.alg.tracker.tld.TldRegion)

Example 4 with TldRegion

use of boofcv.alg.tracker.tld.TldRegion in project BoofCV by lessthanoptimal.

the class VisualizeTldDetectionApp method printDetectedConfidence.

private void printDetectedConfidence() {
    FastQueue<TldRegion> detected = tracker.getDetection().getLocalMaximums();
    System.out.println("Target: " + target);
    for (int i = 0; i < detected.size; i++) {
        TldRegion r = detected.get(i);
        System.out.println(r.rect + " confidence: " + r.confidence + "  connections " + r.connections);
    }
}
Also used : TldRegion(boofcv.alg.tracker.tld.TldRegion)

Example 5 with TldRegion

use of boofcv.alg.tracker.tld.TldRegion in project BoofCV by lessthanoptimal.

the class VisualizeTldDetectionApp method drawDetections.

private void drawDetections(Graphics2D g2, FastQueue<TldRegion> detected, int shift) {
    double max = 0;
    double min = Double.MAX_VALUE;
    for (int i = 0; i < detected.size; i++) {
        TldRegion r = detected.get(i);
        if (r.confidence > max) {
            max = r.confidence;
        }
        if (r.confidence < min) {
            min = r.confidence;
        }
    }
    double range = max - min;
    for (TldRegion r : detected.toList()) {
        int v = (int) (255 * (r.confidence - min) / range);
        int rgb = v << shift;
        drawRectangle(g2, r.rect, new Color(rgb), 3);
    }
}
Also used : TldRegion(boofcv.alg.tracker.tld.TldRegion)

Aggregations

TldRegion (boofcv.alg.tracker.tld.TldRegion)5 NccFeature (boofcv.struct.feature.NccFeature)1