import java.util.HashMap; public interface ExtraCredit { /** Finds the quality of match score, assuming that the upper left corner of * the foreground photo is aligned to position (x, y) in the background photo, * and that the two photos may be different sizes. The quality of match score * is only averaged over the overlapping pixels. * @param foreground the foreground photo. * @param background the background photo. * @param x the x coordinate of the upper left of the foreground photo relative to the background. * @param y the y coordinate of the upper left of the foreground photo relative to the background. * @return the matching score. */ public double getMatch(Photo foreground, Photo background, int x, int y); /** Finds the quality of match score between two photos, but the result * is taken as the best possible score over all possible choices * of (x, y) which overlap by at least n pixels. That is, the first * version of getMatch() is used, but the value of the first version * depends on the (x, y) offset which is chosen, so we want to pick * the (x, y) which gives us the best possible score. The reason for * the n is that you can sometimes get an easy perfect match by just * matching a single pixel in the corner - we can avoid this by requiring * that two photos overlap by at least n pixels if we want the score to * count. * @param foreground the foreground photo. * @param background the background photo. * @param n the minimum number of pixels overlap for a score to be considered. * @return the matching score. */ public double getMatch(Photo foreground, Photo background, int n); /** Same as the normal version of getBestMatch(), except that it uses * the extra-credit version of getMatch() with the given n value. * @param matches a hashmap which contains the set of foreground-to-background matchings which comprise the best result. * @param n the minimum number of pixels overlap for a score to be considered. * @return the matching of the best match. */ public double getBestMatch(HashMap matches, int n); }