Index: other-projects/is-sheet-music-encore/trunk/image-identification-terminal/Makefile
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-terminal/Makefile	(revision 33138)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-terminal/Makefile	(revision 33141)
@@ -1,24 +1,20 @@
 #https://www.tensorflow.org/install/lang_java
-#testClassifier runs the cmd below
 #java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/  javaImageClassifier TestImages/Test.png 1
 
-test-run-classifier01:
+run-classifier-houghlinesP:
+        #Compile
 	javac javaAccuracyCalculator.java
 	javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaImageClassifier.java;
-	./testClassifer.sh TestImages 1
+        #Run javaImageClassifier on all images in TestImages
+	./runClassifer.sh TestImages houghlinesP
 	echo "Displaying javaImageClassifier output"
+        #Display output of javaImageClassifier
 	less log.txt
-	java javaAccuracyCalculator log.txt 1 results.txt
+        #Calculate the Accuracy of the classifier
+	java javaAccuracyCalculator log.txt houghlinesP results.txt
+        #Display output
 	less results.txt
 	rm log.txt
+	rm results.txt
 
 
-image-run-classifier01:
-	javac javaAccuracyCalculator.java
-	javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaImageClassifier.java;
-	./testClassifer.sh ../download-images/BK 1
-	echo "Displaying javaImageClassifier output"
-	less log.txt
-	java javaAccuracyCalculator log.txt 1 results.txt
-	less results.txt
-	rm log.txt
Index: other-projects/is-sheet-music-encore/trunk/image-identification-terminal/Makefile~
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-terminal/Makefile~	(revision 33141)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-terminal/Makefile~	(revision 33141)
@@ -0,0 +1,14 @@
+#https://www.tensorflow.org/install/lang_java
+#testClassifier runs the cmd below
+#java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/  javaImageClassifier TestImages/Test.png 1
+
+test-run-classifier01:
+	javac javaAccuracyCalculator.java
+	javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaImageClassifier.java;
+	./testClassifer.sh TestImages 1
+	less log.txt
+	java javaAccuracyCalculator log.txt 1 results.txt
+	rm log.txt
+
+
+
Index: other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaAccuracyCalculator.java
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaAccuracyCalculator.java	(revision 33138)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaAccuracyCalculator.java	(revision 33141)
@@ -1,3 +1,2 @@
-
 import java.io.File;
 import java.io.BufferedReader;
@@ -5,10 +4,10 @@
 import java.io.FileReader;
 import java.io.FileWriter;
-
-
 public class javaAccuracyCalculator{
-
-    public static void main(String[] args) {
-    	
+					
+	//Read in log.txt, grab first item in array of each line
+	//Counter for everytime have readline
+	//Calculate accuracy rate
+    public static void main(String[] args) {   	
         try {
 			if (args.length != 3) {
@@ -21,34 +20,39 @@
 				FileReader fileReader = new FileReader(inputFilename);
 				BufferedReader buf = new BufferedReader(fileReader);
-				FileWriter fw = new FileWriter(outputFilename);
+				FileWriter fw = new FileWriter(outputFilename,true);
 				String line = null;
 				String[] item;
-				float accuracyRate = 0;
-				int trueCount	= 0;				
-				int lineCount	= 0;
-				
-				//RENAME CLASSIFIER NUMBER TO ACTUALL CLASSIFIER
-				if(classifierType.equals("1")){classifierType = "Probabilistic HoughLines";}
-				
+				float trueAccuracyRate  =0;
+				float falseAccuracyRate =0;
+				int trueCount	= 0;
+				int falseCount  = 0;				
+				int sheetMusicCount	= 0;
+				int notSheetMusicCount	= 0;
 				//Splits into each record, since readLine splits by "\n"
 				while ((line = buf.readLine()) != null) {
-					lineCount++;
-					//Splits by tab, leaves "" for every blank entry
-					item = line.split("\t");
-					//Check first element (true or false)
-					if(item[0].equals("1")){
-						trueCount++;
+					item = line.split("\t");		
+					//Calculate AccuracyRates
+					if(item[1].contains("TestImages/SheetMusic/")){
+						sheetMusicCount++;
+						if(item[3].equals("true")){
+							trueCount++;
+						}
+					}
+					if(item[1].contains("TestImages/NotSheetMusic/")){
+						notSheetMusicCount++;
+						if(item[3].equals("true")){
+							falseCount++;
+						}
 					}						
 				}
-				accuracyRate = ((float)trueCount/(float)lineCount)*(float)100;
-				fw.write("Classifier:" + classifierType + "\t" + accuracyRate + "%" + "\n");		
+				
+				//Amount of sheetMusic classified images / total amount of images read 
+				trueAccuracyRate = ((float)trueCount/(float)sheetMusicCount)*(float)100;
+				//Amount of notSheetMusic classified images / total amount of images read 
+				falseAccuracyRate = ((float)falseCount/(float)notSheetMusicCount)*(float)100;
+				
+				fw.write("Classifier: " + classifierType + '\t' + "SheetMusicAccuracyRate: " + trueAccuracyRate + "%" + '\t' + "NotSheetMusicAccuracyRate :" + falseAccuracyRate + "%" + "\n");		
 				buf.close();
-				fw.close();
-					
-				//Read in log.txt, grab first item in array of each line
-				//counter for everytime have readline
-
-				//Calculate accuracy rate
-								
+				fw.close();								
 			}
         }
Index: other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaImageClassifier.java
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaImageClassifier.java	(revision 33138)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaImageClassifier.java	(revision 33141)
@@ -22,24 +22,14 @@
 
 
-//GOAL for 21st
+//OUTPUT OF THIS JAVA PROGRAM FOUND IN log.txt
+//Each image processed will have an output of
+//True  =classifierType + 1 + Filename + Status 
+//False =classifierType + 0 + Filename + Status
+public class javaImageClassifier{
+	//Constants
+	static int CLASSIFIER_HOUGHLINESP_MIN = 10;
+	static int CLASSIFIER_HOUGHLINESP_MAX = 50;
 
-
-//Classifier 01
-//Have args so can call "java image-identification-classifier01 XX XX"
-//args can be parameters in algorthim such as threshold or theta?
-//Run on 5000 images.
-//Record success rates
-//All done with makefile
-
-
-//But first understand houghline transform
-//Know what the algorithm being used is doing.
-//MAke constants for this classifier
-//Make java be able to run on CMD line
-
-public class javaImageClassifier{
-
-    public static void main(String[] args) {
-    	
+    public static void main(String[] args) {  	
         try {
 			if (args.length != 2) {
@@ -47,26 +37,24 @@
 			}
 			else {
+				Boolean result = null;
 				String imageFilename = args[0];
-				int classifierType = Integer.parseInt(args[1]);
-				
-				String result = null;
+				String classifierType = args[1];			
 				//Execute classifierType defined from arguement
 				switch(classifierType){
-				case 1:
-					result = classifier01(imageFilename);
+				case "houghlinesP":
+					result = setup_HoughLineP(imageFilename); //true or false
 					break;
-				case 2:
+				default:
 					System.out.println("unknown");
 					break;
-				}
-			
+				}			
 				//Write output to disc
 				File log = new File("log.txt");
 				FileWriter fileWriter = new FileWriter(log, true);
 				BufferedWriter bw = new BufferedWriter(fileWriter);
-				bw.write(result + classifierType + '\n');
-				bw.close();
-
-				
+				//Split output by tab for processing in next java program
+				//imageFilename = 1, result = 3, classifierType = 4
+    			bw.write("Filename:" + '\t' + imageFilename + '\t' + "Classified as:" + '\t' + result + '\t' + classifierType + '\n');
+				bw.close();				
 			}
         }
@@ -75,5 +63,8 @@
         }
     }  
-    private static String classifier01(String filename){
+    //Returns
+    //True = 1 + Filename + Status
+    //False= 0 + Filename + Status
+    private static Boolean setup_HoughLineP(String filename){
 	System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
 	Boolean isSheetMusic = null;
@@ -97,8 +88,9 @@
 		Imgproc.line(edgesDetectedRGB, new Point(l[0], l[1]), new Point(l[2], l[3]), new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
 	    }
+	    
 	    //Convert MAT into a BufferedImage
 	    BufferedImage toBeClassifiedImg = toBufferedImage(edgesDetectedRGB);
 	    //Calculate if its sheet music or not
-	    isSheetMusic = Classifier(toBeClassifiedImg);  
+	    isSheetMusic = classifier_HoughLineP(toBeClassifiedImg);  
 	            
         //Save Processed Image
@@ -109,32 +101,26 @@
 		processedFile = "proc_F_"+filename;
 	    }
-	    imwrite(processedFile, edgesDetectedRGB);
-	    
-	     //Display Results
-            //HighGui.imshow("Source", original);
-            //HighGui.imshow("Just Edges", justEdges); //TESTING
-            //HighGui.imshow("Detected Lines (in red) - Standard Hough Line Transform", edgesDetectedRGB);
-            //HighGui.imshow("Detected Lines (in red) - Probabilistic Line Transform", edgesDetectedRGBProb);
-
-            // Wait and Exit
-            //HighGui.waitKey();
-            //System.exit(0);
-	    		    
+	    imwrite(processedFile, edgesDetectedRGB);	    		    
 	}
 	catch(Exception e){
             System.err.println(e);
         }
-        if (isSheetMusic == true){    
-    		return (1 + "\t" + "Filename: " + filename + "  Status: " + isSheetMusic  +"\t" );}
-    	
-    	else{
-    		return (0 + "\t" + "Filename: " + filename + "  Status: " + isSheetMusic  +"\t" );}
-    }
-    
-    private static boolean Classifier(BufferedImage img){
+        return isSheetMusic;
+    /*    
+    if (isSheetMusic == true){    
+    	return (1 + "\t" + "Filename: " + filename + "  Status: " + isSheetMusic  +"\t" );
+    }	
+    else{
+    	return (0 + "\t" + "Filename: " + filename + "  Status: " + isSheetMusic  +"\t" );
+    } */
+ }
+ 
+ //******************
+ //INTERNAL FUNCTIONS
+ //******************
+    private static boolean classifier_HoughLineP(BufferedImage img){
     System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
     try {
     	//Read file
-    	//BufferedImage img = ImageIO.read(new File(processedFile));
         int x = img.getWidth();
         int y = img.getHeight();
@@ -142,5 +128,4 @@
         int redCount    = 0;
         float percentage = 0;
-
         //Go Thru every pixel
         for(int i=0; i < y; i++){
@@ -157,8 +142,6 @@
        	//Calculate percentage of Red in image
        	percentage = ((float)redCount/(float)pixelCount)*(float)100;
-    
-              
         //If more than %10 and less than %50 then its sheet music!
-        if(percentage > 10 && percentage < 50){ //MAKE THESE CONSTANTS!!
+        if(percentage > 10 && percentage < 50){
         	return true;}
         }
@@ -168,5 +151,4 @@
         return false;
     }
-
         private static  BufferedImage toBufferedImage(Mat mat){
         //MOSTLY COPY PASTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -189,6 +171,4 @@
         }
         return null;
-    }
-
- 
+    } 
 }
Index: other-projects/is-sheet-music-encore/trunk/image-identification-terminal/runClassifer.sh
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-terminal/runClassifer.sh	(revision 33141)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-terminal/runClassifer.sh	(revision 33141)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+if [ $# != 2 ] ; then 
+  echo "Usage: ./testClassifier.sh file_name classifier_type" 1>&2
+  exit 1
+fi
+
+folder_name=$1
+classifier_type=$2
+#Runs javaImageClassifier on ALL images
+for file_name in $folder_name/*/*.png; do
+	echo $file_name
+	echo ""
+	java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/  javaImageClassifier $file_name $classifier_type
+done
