Index: other-projects/is-sheet-music-encore/trunk/download-images/imageErrors.txt
===================================================================
--- other-projects/is-sheet-music-encore/trunk/download-images/imageErrors.txt	(revision 33110)
+++ other-projects/is-sheet-music-encore/trunk/download-images/imageErrors.txt	(revision 33110)
@@ -0,0 +1,11 @@
+BK/loc.ark+\=13960\=t0rr2qg0x-7.png	invalid or incomplete server response
+BK/psia.ark+=13960=t32247g0m-9.png	invalid or incomplete server response
+BK/txa.tarb004317-3.png			invalid or incomplete server response
+SE/mdp.39015068551863-7.png		invalid or incomplete server response
+SE/miun.aag3648.0005.008-1.png		invalid or incomplete server response	
+SE/miun.aag3648.0005.008-2.png		invalid or incomplete server response	
+SE/nc01.ark+=13960=t8jd5wr51-2.png	no server avaiable to complete request
+SE/nc01.ark+=13960=t8jd5wr51-3.png	no server avaiable to complete request
+SE/ufl1.ark+=13960=t8z90c79t-3.png	invalid or incomplete server response
+SE/uiuo.ark+=13960=t4nk57820-7.png	invalid or incomplete server response
+SE/uiuo.ark+=13960=t63556b5c-5.png	invalid or incomplete server response
Index: other-projects/is-sheet-music-encore/trunk/image-identification-development/.idea/workspace.xml
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-development/.idea/workspace.xml	(revision 33097)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-development/.idea/workspace.xml	(revision 33110)
@@ -4,4 +4,5 @@
     <list default="true" readonly="true" id="9bad4f92-4a7d-46a2-b6f0-94214c9f55cc" name="Default" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Test_HoughLineP.png" beforeDir="false" afterPath="$PROJECT_DIR$/Test_HoughLineP.png" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/out/production/image-identification/Main.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/image-identification/Main.class" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Main.java" afterDir="false" />
@@ -20,6 +21,6 @@
         <entry file="file://$PROJECT_DIR$/src/Main.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="2520">
-              <caret line="168" lean-forward="true" selection-start-line="168" selection-end-line="168" />
+            <state relative-caret-position="694">
+              <caret line="174" column="36" lean-forward="true" selection-start-line="174" selection-start-column="36" selection-end-line="174" selection-end-column="36" />
               <folding>
                 <element signature="imports" expanded="true" />
@@ -39,8 +40,8 @@
   </component>
   <component name="ProjectFrameBounds" extendedState="6">
-    <option name="x" value="451" />
-    <option name="y" value="135" />
-    <option name="width" value="1370" />
-    <option name="height" value="910" />
+    <option name="x" value="712" />
+    <option name="y" value="69" />
+    <option name="width" value="1350" />
+    <option name="height" value="850" />
   </component>
   <component name="ProjectView">
@@ -57,5 +58,5 @@
     <property name="GenerateAntBuildDialog.outputFileNameProperty" value="image-identification" />
     <property name="full.screen.before.presentation.mode" value="false" />
-    <property name="last_opened_file_path" value="$USER_HOME$/Desktop" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
     <property name="project.structure.last.edited" value="Modules" />
     <property name="project.structure.proportion" value="0.15" />
@@ -131,4 +132,5 @@
       <window_info anchor="right" id="Palette" order="4" />
       <window_info anchor="bottom" id="TODO" order="10" />
+      <window_info anchor="bottom" id="Messages" order="3" weight="0.32924336" />
       <window_info anchor="right" id="Palette&#9;" order="1" />
       <window_info id="Image Layers" order="4" />
@@ -136,5 +138,5 @@
       <window_info anchor="bottom" id="Event Log" order="1" side_tool="true" />
       <window_info anchor="right" id="Maven Projects" order="3" />
-      <window_info anchor="bottom" id="Run" order="6" weight="0.26993865" />
+      <window_info anchor="bottom" id="Run" order="6" weight="0.26789367" />
       <window_info anchor="bottom" id="Version Control" order="2" />
       <window_info anchor="bottom" id="Terminal" order="0" weight="0.42638037" />
@@ -149,5 +151,4 @@
       <window_info id="Favorites" order="3" side_tool="true" />
       <window_info anchor="right" content_ui="combo" id="Hierarchy" order="7" weight="0.25" />
-      <window_info anchor="bottom" id="Messages" order="3" />
       <window_info anchor="bottom" id="Inspection" order="9" weight="0.4" />
       <window_info anchor="bottom" id="Inspection Results" order="11" weight="0.32924336" />
@@ -161,7 +162,6 @@
       <window_info anchor="right" content_ui="combo" id="Hierarchy" order="7" weight="0.25" />
       <window_info anchor="right" id="Capture Analysis" order="0" />
-      <window_info anchor="bottom" id="Run" order="6" visible="true" weight="0.34662578" />
+      <window_info anchor="bottom" id="Version Control" order="2" />
       <window_info anchor="right" id="Theme Preview" order="2" />
-      <window_info anchor="bottom" id="Cvs" order="8" weight="0.25" />
       <window_info content_ui="combo" id="Project" order="5" visible="true" weight="0.18382749" />
       <window_info id="Structure" order="6" side_tool="true" weight="0.25" />
@@ -169,4 +169,5 @@
       <window_info anchor="right" id="Ant Build" order="6" weight="0.25" />
       <window_info anchor="bottom" id="TODO" order="10" />
+      <window_info anchor="bottom" id="Run" order="6" visible="true" weight="0.34662578" />
       <window_info id="Image Layers" order="4" />
       <window_info id="Designer" order="0" />
@@ -178,5 +179,5 @@
       <window_info anchor="bottom" id="Event Log" order="1" side_tool="true" />
       <window_info anchor="bottom" id="Inspection" order="9" weight="0.4" />
-      <window_info anchor="bottom" id="Version Control" order="2" />
+      <window_info anchor="bottom" id="Cvs" order="8" weight="0.25" />
       <window_info id="Capture Tool" order="2" />
       <window_info anchor="bottom" id="Message" order="4" />
@@ -191,8 +192,28 @@
   <component name="XDebuggerManager">
     <breakpoint-manager>
-      <option name="time" value="2" />
+      <option name="time" value="3" />
     </breakpoint-manager>
   </component>
   <component name="editorHistoryManager">
+    <entry file="file://$PROJECT_DIR$/src/Main.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1620">
+          <caret line="108" column="29" lean-forward="true" selection-start-line="108" selection-start-column="29" selection-end-line="108" selection-end-column="29" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/Main.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="2520">
+          <caret line="168" lean-forward="true" selection-start-line="168" selection-end-line="168" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
     <entry file="file://$PROJECT_DIR$/src/Main.java">
       <provider selected="true" editor-type-id="text-editor">
@@ -324,6 +345,6 @@
     <entry file="file://$PROJECT_DIR$/src/Main.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="2520">
-          <caret line="168" lean-forward="true" selection-start-line="168" selection-end-line="168" />
+        <state relative-caret-position="694">
+          <caret line="174" column="36" lean-forward="true" selection-start-line="174" selection-start-column="36" selection-end-line="174" selection-end-column="36" />
           <folding>
             <element signature="imports" expanded="true" />
Index: other-projects/is-sheet-music-encore/trunk/image-identification-development/Notes.txt
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-development/Notes.txt	(revision 33110)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-development/Notes.txt	(revision 33110)
@@ -0,0 +1,41 @@
+Houghlines in java.
+Houghlines does detect white lines. Use binary_inv to show with houghlineTest.png
+
+OTSU threshold gives best black and white response
+
+Would it be useful to process what lines have been detected?
+As in, filter out every line detected except for horizontal lines?
+
+BINARYINV seems to be result in a better looking image than canny for sheet music
+
+In houghlines parameters, having resoluation of 1 degree and 1 pixel makes sense. Would allow for sheet music image to be at any orientation.
+Threshold would ideally need to vary dependant on how much sheet music there is.
+Which brings to the table filtering. Having a good filter that eliminates noise leaves the sheet music free would be good. The binary inv would be suitable, since houghlines detect white lines.
+Need filter to denoize image. OTSU seems to do a good job.
+
+The threshold would need to be adjusted dependant on how many white pixels there are.
+houghlinesP has start and end points. where houghlines does not. Which is why houghlinesP performs better on a set of images becuz of the end points rather than just "a line must meet a certain threshold at that coordinate for it to be registered"
+Houghlines in order to be effetive must be scaled to suit the image.
+
+HoughlinesP contains this:
+minLinLength: The minimum number of points that can form a line. Lines with less than this number of points are disregarded.
+maxLineGap: The maximum gap between two points to be considered in the same line.
+
+____ _____     ______ 	______
+
+HoughlinesP can calculate on a local scale, comaparing the distance between just the gap in the line.
+Houghlines  only calculates on the lines scale, checking the whole lines point count(attenuator?) reaching over the threshold.
+
+This means houghlinesP can scale better and allow for more accurate results
+
+
+The mathRound does not make difference
+
+Drawing forloop with cols, seems to be less effective
+Even though it does employ same calculations? 
+https://stackoverflow.com/questions/29493267/how-to-detect-lines-using-houghlines-in-opencv-java
+
+
+
+not enough MP records with more than 10 pages
+
Index: other-projects/is-sheet-music-encore/trunk/image-identification-development/src/Main.java
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-development/src/Main.java	(revision 33097)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-development/src/Main.java	(revision 33110)
@@ -100,7 +100,8 @@
             Mat edgesDetected = new Mat();
             Mat edgesDetectedRGB = new Mat();
+            Mat forOTSU = new Mat();
             Mat edgesDetectedRGBProb;
             Mat justEdges; //TESTING
-            String default_file = "Test02.png";
+            String default_file = "TestImages/houghlineTest.png";
             String filename = ((args.length > 0) ? args[0] : default_file);
 
@@ -108,57 +109,74 @@
             Mat original = Imgcodecs.imread(filename, Imgcodecs.IMREAD_GRAYSCALE);
             // Edge detection
-            Imgproc.Canny(original, edgesDetected, 50, 200, 3, false);
-            //Copy edges to the images that will display the results in BGR
+            //01 CANNY
+            //Imgproc.Canny(original, edgesDetected, 50, 200, 3, false);
+            //02 BINARYINV
+            Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV,15, 2);
+            //03 BINARY
+            //Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY,15, 2);
+            //04 NO PROC
+            //edgesDetected = original.clone();
+            //05 OTSU THRESHOLD
+            //Imgproc.threshold(original, edgesDetected,0,255,Imgproc.THRESH_BINARY_INV+Imgproc.THRESH_OTSU);
+
+
+
+            //Convert to RGB
             Imgproc.cvtColor(edgesDetected, edgesDetectedRGB, Imgproc.COLOR_GRAY2BGR);
-            edgesDetectedRGBProb = edgesDetectedRGB.clone();
-
-            justEdges = edgesDetectedRGBProb.clone();//TESTING
+            justEdges = edgesDetectedRGB.clone();//TESTING
 
             // Standard Hough Line Transform
             Mat lines = new Mat(); // will hold the results of the detection
-            //(edgeDetectedImage, outputOfDetection(r,Îž), resolution of r, resolution of Îž, threshold (minimum num of intersections)
-            Imgproc.HoughLines(edgesDetected, lines, 1.4, Math.PI / 180, 500); // runs the actual detection
+            //(edgeDetectedImage, outputOfDetection(r,Îž), resolution of rho, resolution of theta, threshold (minimum num of intersections)
+            Imgproc.HoughLines(edgesDetected, lines, 1, Math.PI / 180.0, 350); // runs the actual detection
+            //Imgproc.HoughLines(edgesDetected, lines, 5.0, 4.0, 7); // runs the actual detection
 
-            // Draw the lines
-            //LOOK OVER THIS AGAIN THE 1000 might be image height?
-            //THRESHOLD should be changed, based on img dimensions?
+            //make some test images. black and white. row of white row of black. call hough transform. check if its displaying as expected
+            //make sure res of 0 is appropriate, try 360
+            //expect theta values of 0+-
+            //try greyscale image
 
-            for (int x = 0; x < lines.rows(); x++) {
-                double rho = lines.get(x, 0)[0],
-                        theta = lines.get(x, 0)[1];
-                //CONVERT to Cartisean coord
-                double a = Math.cos(theta), b = Math.sin(theta);
-                double x0 = a * rho, y0 = b * rho;
 
-                Point pt1 = new Point(Math.round(x0 + 1000 * (-b)), Math.round(y0 + 1000 * (a)));
-                Point pt2 = new Point(Math.round(x0 - 1000 * (-b)), Math.round(y0 - 1000 * (a)));
-                Imgproc.line(edgesDetectedRGB, pt1, pt2, new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
+            for (int i = 0; i < lines.cols(); i++) {
+                double rho = lines.get(0, i)[0];
+                double theta = lines.get(0, i)[1];
+                double cosTheta = Math.cos(theta);
+                double sinTheta = Math.sin(theta);
+                double x0 = cosTheta * rho;
+                double y0 = sinTheta * rho;
+                double xpt1 = x0 + 10000 * (-sinTheta);
+                double ypt1 = y0 + 10000 * (cosTheta);
+                double xpt2 = x0 - 10000 * (-sinTheta);
+                double ypt2 = y0 - 10000 * (cosTheta);
+                double angle = Core.fastAtan2((float)ypt2 - (float)ypt1, (float)xpt2 - (float)xpt1) * (Math.PI/180.0);
+                Point pt1 = new Point(xpt1, ypt1);
+                Point pt2 = new Point(xpt2, ypt2);
+                Imgproc.line(edgesDetectedRGB, pt1, pt2, new Scalar(0, 0, 255), 3, Imgproc.LINE_AA,0);
+                System.out.println("rho: " + rho + '\n' + "theta: " + theta + '\n' + "angle: " + angle);
             }
 
-            // Probabilistic Line Transform
-            Mat linesP = new Mat(); // will hold the results of the detection
-            Imgproc.HoughLinesP(edgesDetected, linesP, 1, Math.PI / 180, 50, 50, 10); // runs the actual detection
-            // Draw the lines
-            for (int x = 0; x < linesP.rows(); x++) {
-                double[] l = linesP.get(x, 0);
-                Imgproc.line(edgesDetectedRGBProb, new Point(l[0], l[1]), new Point(l[2], l[3]), new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
+            /*
+            for (int x = 0; x < lines.rows(); x++) {
+                double rho = lines.get(x, 0)[0];
+                double theta = lines.get(x, 0)[1];
+                double cosTheta = Math.cos(theta);
+                double sinTheta = Math.sin(theta);                //CONVERT to Cartisean coord
+                double x0 = cosTheta * rho;
+                double y0 = sinTheta * rho;
+
+                double xpt1 = Math.round(x0 + 10000 * (-sinTheta));
+                double ypt1 = Math.round(y0 + 10000 * (cosTheta));
+                double xpt2 = Math.round(x0 - 10000 * (-sinTheta));
+                double ypt2 = Math.round(y0 - 10000 * (cosTheta));
+                double angle = Core.fastAtan2((float)ypt2 - (float)ypt1, (float)xpt2 - (float)xpt1) * (Math.PI/180.0);
+
+                Point pt1 = new Point(xpt1, ypt1);
+                Point pt2 = new Point(xpt2, ypt2);
+                Imgproc.line(edgesDetectedRGB, pt1, pt2, new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
+
+                System.out.println("rho: " + rho + '\n' + "theta: " + theta + '\n' + "angle: " + angle);
             }
+            */
 
-            //Convert MAT into a BufferedImage
-            BufferedImage toBeClassifiedImg = toBufferedImage(edgesDetectedRGBProb);
-
-            //Calculate if its sheet music or not
-            Boolean isSheetMusic = Classifier(toBeClassifiedImg);
-            System.out.println("Filename: " + filename + "  Status: " + isSheetMusic);
-
-            //Save Processed Image
-            String processedFile = null;
-            if (isSheetMusic == true) {
-                //NEED FIGURE OUT HOW RUN IN SCRIPT. THEN USE ARGS as filename + "HoughLineP + "png"
-                processedFile = "SheetMusic/Test_HoughLineP.png";
-            }else {
-                processedFile = "Test_HoughLineP.png";
-            }
-            imwrite(processedFile, edgesDetectedRGBProb);
 
             //Display Results
Index: other-projects/is-sheet-music-encore/trunk/image-identification-terminal/Makefile
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-terminal/Makefile	(revision 33097)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-terminal/Makefile	(revision 33110)
@@ -14,3 +14,11 @@
 
 
-
+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/results.txt
===================================================================
--- other-projects/is-sheet-music-encore/trunk/image-identification-terminal/results.txt	(revision 33097)
+++ other-projects/is-sheet-music-encore/trunk/image-identification-terminal/results.txt	(revision 33110)
@@ -1,1 +1,1 @@
-Classifier:Probabilistic HoughLines	100.0%
+Classifier:Probabilistic HoughLines	30.08%
