public static void clusterByHistogram(Path baseDir, Path inputDir){
		
		deleteAllJPEGFiles(baseDir);
		deleteAllJPEGFiles(inputDir);
		
		File[] baseFileList = baseDir.toFile().listFiles();
		List<Mat> baseHistList = new ArrayList<>();
		
		for(File baseImage : baseFileList) {
			Mat baseHist = generatHist(baseDir, baseImage);
			baseHistList.add(baseHist);
		}
		
		
		File[] inputFileList = inputDir.toFile().listFiles();
		for(File inputImage : inputFileList) {
			//int j=0;
			boolean flag = false;
			double maxSimilarity = 0;
			for(Mat baseHist: baseHistList) {
				Mat inputHist = generatHist(inputDir, inputImage);
				//System.out.println("\n\nCompared input file " + inputImage.getName().toString() + " with base hist " + (j+1));
	
				/*double similarity = Imgproc.compareHist(baseHist, inputHist, Imgproc.CV_COMP_BHATTACHARYYA);
				System.out.println("Similarity by bhattacharya is " + similarity);
				
				similarity = Imgproc.compareHist(baseHist, inputHist, Imgproc.CV_COMP_CHISQR);
				System.out.println("Similarity by chisqr is " + similarity);
				
				similarity = Imgproc.compareHist(baseHist, inputHist, Imgproc.CV_COMP_CORREL);
				System.out.println("Similarity by correlation is " + similarity);
				
				similarity = Imgproc.compareHist(baseHist, inputHist, Imgproc.CV_COMP_HELLINGER);
				System.out.println("Similarity by hellinger is " + similarity);*/
				
				double similarity = Imgproc.compareHist(baseHist, inputHist, Imgproc.CV_COMP_INTERSECT);
				if(similarity > 50000) {
					flag = true;
					if(maxSimilarity < similarity) {
						maxSimilarity = similarity;
					}
				}
				//System.out.println("Similarity by intersect is " + similarity);
				//j++;
			}
			//System.out.println("Max similarity is " + maxSimilarity);
			if(flag) {
				System.out.println("yes " + inputImage.getName().toString() + " is a building");
			} else {
				System.out.println("no " + inputImage.getName().toString() + " is not a building");
			}
		}
	}