package main;
import java.util.Locale;
import java.util.Scanner;

public class Program {
	public static Scanner keyb = new Scanner(System.in);
	public static void main(String[]args) {
		keyb.useLocale(Locale.ENGLISH);
		//distance();
		//similarity();
	}
	public static void distance() {
		int[][] charlie = Helper.read("images/onions.png");
		int[][] charlie_beach = Helper.read("images/food.png");
		double[][] distance = DistanceBasedSearch.distanceMatrix(charlie, charlie_beach); 
		int n=0;
		do {
		System.out.println("Combien de motifs voulez vous trouvez");
		n=keyb.nextInt();
		}while(n<1);
		if (n==1) {
			int p[]=Collector.findBest(distance, true);
			Helper.drawBox(p[0], p[1], charlie[0].length, charlie.length, charlie_beach);
		}else {
		int[][] p = Collector.findNBest(n, distance, true);
		for (int i=0; i<n; ++i) {
			Helper.drawBox(p[i][0], p[i][1], charlie[0].length, charlie.length, charlie_beach);
		}
		}
		Helper.show(charlie_beach, "Found!");
		System.out.println("Found!");
	}
	public static void similarity() {
	    int[][] charlie = Helper.read("images/charlie.png");
	    int[][] beach = Helper.read("images/charlie_beach.png");
	    double[][] beachGray = ImageProcessing.toGray(beach);
	    double[][] charlieGray = ImageProcessing.toGray(charlie);
	    double[][] similarity = SimilarityBasedSearch.similarityMatrix(charlieGray, beachGray); 
	    int[] p = Collector.findBest(similarity, false);
	    System.out.println("drawBox at (" + p[0] + "," + p[1] + ")");
	    Helper.drawBox(p[0], p[1], charlie[0].length, charlie.length, beach);
	    Helper.show(beach, "Found!");
	}	
}
