responseMapData[y][x] = mode.computeMatchScore(image, template, x+scanX, y+scanY, workingSpace);
responseMapData[y][x] = mode.computeMatchScore(image, template, x+scanX, y+scanY, workingSpace);
private void normCrossCorrelation(FImage imgI, FImage imgJ, FeatureList pt, FeatureList ptTracked, boolean[] status, int winsize_ncc) { for (int i = 0; i < status.length; i++) { boolean tracked = status[i]; FBNCCFeature feat = (FBNCCFeature) pt.features[i]; FBNCCFeature featTracked = (FBNCCFeature) ptTracked.features[i]; if (tracked) { feat.ncc = TemplateMatcher.Mode.NORM_SUM_SQUARED_DIFFERENCE .computeMatchScore(imgI.pixels, (int) feat.x, (int) feat.y, imgJ.pixels, (int) featTracked.x, (int) featTracked.y, winsize_ncc, winsize_ncc); } else { feat.ncc = Float.NaN; } } }
/** * Construct with the template to match, the mode with which to * estimate template responses and the bounds rectangle in which * to search. The search bounds rectangle is defined with respect * to the centre of the template. * * @param template The template * @param mode The mode. * @param bounds The bounding box for search. */ public TemplateMatcher(FImage template, Mode mode, Rectangle bounds) { this.searchBounds = bounds; this.mode = mode; this.template = mode.prepareTemplate(template); this.workingSpace = mode.prepareWorkingSpace(this.template); }
/** * Construct with the template to match, the mode with which to * estimate template responses and the bounds rectangle in which * to search. The search bounds rectangle is defined with respect * to the centre of the template. * * @param template The template * @param mode The mode. * @param bounds The bounding box for search. */ public TemplateMatcher(FImage template, Mode mode, Rectangle bounds) { this.searchBounds = bounds; this.mode = mode; this.template = mode.prepareTemplate(template); this.workingSpace = mode.prepareWorkingSpace(this.template); }
/** * Default constructor with the template to match and the mode * with which to estimate template responses. When matching is * performed by {@link #analyseImage(FImage)}, the whole image * will be searched. * * @param template The template * @param mode The mode. */ public TemplateMatcher(FImage template, Mode mode) { this.mode = mode; this.template = mode.prepareTemplate(template); this.workingSpace = mode.prepareWorkingSpace(this.template); }
/** * Default constructor with the template to match and the mode * with which to estimate template responses. When matching is * performed by {@link #analyseImage(FImage)}, the whole image * will be searched. * * @param template The template * @param mode The mode. */ public TemplateMatcher(FImage template, Mode mode) { this.mode = mode; this.template = mode.prepareTemplate(template); this.workingSpace = mode.prepareWorkingSpace(this.template); }
/** * Get the top-N "best" responses found by the template matcher. * * @param numResponses The number of responses * @return the best responses found */ public FValuePixel[] getBestResponses(int numResponses) { Comparator<FValuePixel> comparator = mode.scoresAscending() ? FValuePixel.ReverseValueComparator.INSTANCE : FValuePixel.ValueComparator.INSTANCE; return getBestResponses(numResponses, responseMap, getXOffset(), getYOffset(), comparator); }
/** * Get the top-N "best" responses found by the template matcher. * * @param numResponses The number of responses * @return the best responses found */ public FValuePixel[] getBestResponses(int numResponses) { Comparator<FValuePixel> comparator = mode.scoresAscending() ? FValuePixel.ReverseValueComparator.INSTANCE : FValuePixel.ValueComparator.INSTANCE; return getBestResponses(numResponses, responseMap, getXOffset(), getYOffset(), comparator); }
/** * * @param f1 * @param f2 * @return correlation between two patches (assumed to be the same size) * calculated using {@link TemplateMatcherMode} */ private float ncc(FImage f1, FImage f2) { final float normcorr = TemplateMatcher.Mode.NORM_CORRELATION.computeMatchScore(f1.pixels, 0, 0, f2.pixels, 0, 0, f1.width, f1.height); return normcorr; }