Changeset 33439
- Timestamp:
- 2019-08-28T17:03:18+12:00 (5 years ago)
- Location:
- other-projects/is-sheet-music-encore/trunk
- Files:
-
- 5 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/is-sheet-music-encore/trunk/Makefile
r33437 r33439 2 2 #Utilities/Test 3 3 #********** 4 hi-res-download-map-middle: 5 ./COMPX520-DOWNLOADER-MIDDLE-PNG.sh java-gen-corpus/MapListNumPages.txt MP 4 6 5 7 compile: … … 78 80 cd image-identification-terminal; ./runClassifer.sh /Scratch/cpb16/is-sheet-music-encore/hires-download-images/SE cluster log-all-hires-new/log-cluster-SE.txt -allNew 79 81 #Calculate accuracy 82 cd image-identification-terminal; echo configClassifierComparison.properties >> log-all-hires-new/results.txt 80 83 cd image-identification-terminal; java javaAccuracyCalculator log-all-hires-new/log-cluster-MU.txt cluster-MU log-all-hires-new/results.txt 81 84 cd image-identification-terminal; java javaAccuracyCalculator log-all-hires-new/log-cluster-BK.txt cluster-BK log-all-hires-new/results.txt -
other-projects/is-sheet-music-encore/trunk/image-identification-dev-02/.idea/workspace.xml
r33437 r33439 40 40 <entry file="file://$PROJECT_DIR$/image-identification-development/src/MainMorph.java"> 41 41 <provider selected="true" editor-type-id="text-editor"> 42 <state relative-caret-position="2 976">43 <caret line=" 501" column="69" selection-start-line="501" selection-start-column="69" selection-end-line="501" selection-end-column="69" />42 <state relative-caret-position="266"> 43 <caret line="407" column="55" selection-start-line="407" selection-start-column="55" selection-end-line="407" selection-end-column="55" /> 44 44 <folding> 45 45 <element signature="imports" expanded="true" /> 46 46 <element signature="class#StartAndEndPoint#0;class#MainMorph#0" /> 47 47 <element signature="method#toBufferedImage#0;class#MainMorph#0" /> 48 <element signature="e#10410#12916#1" /> 49 <element signature="e#13000#15039#1" /> 50 <element signature="e#15107#17754#1" /> 51 <element signature="e#18758#22215#1" /> 52 <element signature="e#19065#19077#0" expanded="true" /> 53 <element signature="e#23397#23409#0" expanded="true" /> 48 <element signature="e#11164#13670#1" /> 49 <element signature="e#13754#15793#1" /> 50 <element signature="e#15861#18508#1" /> 51 <element signature="e#21594#25229#1" /> 54 52 </folding> 55 53 </state> … … 60 58 <entry file="file://$PROJECT_DIR$/../image-identification-terminal/javaClassifierComparison.java"> 61 59 <provider selected="true" editor-type-id="text-editor"> 62 <state relative-caret-position=" 1123">63 <caret line="3 05" selection-start-line="305" selection-end-line="305" />60 <state relative-caret-position="4332"> 61 <caret line="356" selection-start-line="356" selection-end-line="356" /> 64 62 <folding> 65 63 <element signature="imports" expanded="true" /> 66 <element signature="class#StartAndEndPoint#0;class#javaClassifierComparison#0" />67 <element signature="method#StartAndEndPoint#0;class#StartAndEndPoint#0;class#javaClassifierComparison#0" />68 <element signature="class#Pair#0;class#javaClassifierComparison#0" />69 64 <element signature="method#Algorithm_HoughLinesP_Single#0;class#javaClassifierComparison#0" /> 70 65 <element signature="method#Algorithm_HoughLinesP_Combo#0;class#javaClassifierComparison#0" /> 71 <element signature="e#11894#11906#0" expanded="true" />72 66 <element signature="method#Classifier_LineCounter#0;class#javaClassifierComparison#0" /> 73 67 <element signature="method#Classifier_ClusterDetection#0;class#javaClassifierComparison#0" /> 74 68 <element signature="method#removeDuplicates#0;class#javaClassifierComparison#0" /> 75 <element signature="e#17563#18162#1" />76 69 <element signature="method#lineComparison#0;class#javaClassifierComparison#0" /> 77 70 <element signature="method#ClusterCheck#0;class#javaClassifierComparison#0" /> … … 174 167 <component name="ToolWindowManager"> 175 168 <frame x="67" y="25" width="1613" height="1025" extended-state="6" /> 169 <editor active="true" /> 176 170 <layout> 177 171 <window_info content_ui="combo" id="Project" order="0" weight="0.19783024" /> … … 182 176 <window_info anchor="bottom" id="Message" order="0" /> 183 177 <window_info anchor="bottom" id="Find" order="1" /> 184 <window_info a nchor="bottom" id="Run" order="2" weight="0.2494432" />178 <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.2494432" /> 185 179 <window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> 186 180 <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> … … 252 246 <entry file="file://$PROJECT_DIR$/../image-identification-terminal/javaClassifierComparison.java"> 253 247 <provider selected="true" editor-type-id="text-editor"> 254 <state relative-caret-position=" 1123">255 <caret line="3 05" selection-start-line="305" selection-end-line="305" />248 <state relative-caret-position="4332"> 249 <caret line="356" selection-start-line="356" selection-end-line="356" /> 256 250 <folding> 257 251 <element signature="imports" expanded="true" /> 258 <element signature="class#StartAndEndPoint#0;class#javaClassifierComparison#0" />259 <element signature="method#StartAndEndPoint#0;class#StartAndEndPoint#0;class#javaClassifierComparison#0" />260 <element signature="class#Pair#0;class#javaClassifierComparison#0" />261 252 <element signature="method#Algorithm_HoughLinesP_Single#0;class#javaClassifierComparison#0" /> 262 253 <element signature="method#Algorithm_HoughLinesP_Combo#0;class#javaClassifierComparison#0" /> 263 <element signature="e#11894#11906#0" expanded="true" />264 254 <element signature="method#Classifier_LineCounter#0;class#javaClassifierComparison#0" /> 265 255 <element signature="method#Classifier_ClusterDetection#0;class#javaClassifierComparison#0" /> 266 256 <element signature="method#removeDuplicates#0;class#javaClassifierComparison#0" /> 267 <element signature="e#17563#18162#1" />268 257 <element signature="method#lineComparison#0;class#javaClassifierComparison#0" /> 269 258 <element signature="method#ClusterCheck#0;class#javaClassifierComparison#0" /> … … 274 263 <entry file="file://$PROJECT_DIR$/image-identification-development/src/MainMorph.java"> 275 264 <provider selected="true" editor-type-id="text-editor"> 276 <state relative-caret-position="2 976">277 <caret line=" 501" column="69" selection-start-line="501" selection-start-column="69" selection-end-line="501" selection-end-column="69" />265 <state relative-caret-position="266"> 266 <caret line="407" column="55" selection-start-line="407" selection-start-column="55" selection-end-line="407" selection-end-column="55" /> 278 267 <folding> 279 268 <element signature="imports" expanded="true" /> 280 269 <element signature="class#StartAndEndPoint#0;class#MainMorph#0" /> 281 270 <element signature="method#toBufferedImage#0;class#MainMorph#0" /> 282 <element signature="e#10410#12916#1" /> 283 <element signature="e#13000#15039#1" /> 284 <element signature="e#15107#17754#1" /> 285 <element signature="e#18758#22215#1" /> 286 <element signature="e#19065#19077#0" expanded="true" /> 287 <element signature="e#23397#23409#0" expanded="true" /> 271 <element signature="e#11164#13670#1" /> 272 <element signature="e#13754#15793#1" /> 273 <element signature="e#15861#18508#1" /> 274 <element signature="e#21594#25229#1" /> 288 275 </folding> 289 276 </state> -
other-projects/is-sheet-music-encore/trunk/image-identification-dev-02/image-identification-development/src/MainMorph.java
r33437 r33439 193 193 194 194 try { 195 195 196 ArrayList<StartAndEndPoint> pointArrayList = new ArrayList<>(); 196 197 197 198 //Variables 198 int codeVersion = 5; 199 int codeVersion = 4; 200 System.out.println("Running code version: " + codeVersion); 199 201 Mat edgesDetected = new Mat(); 200 202 Mat mid = new Mat(); 201 203 Mat edgesDetectedRGB = new Mat(); 202 204 Mat clustersFoundRGB = new Mat(); 205 203 206 String testDirectory = "/Scratch/cpb16/is-sheet-music-encore/image-identification-dev-02/image-identification-development/"; 204 207 String directory = "/Scratch/cpb16/is-sheet-music-encore/download-images/MU/"; … … 215 218 //String default_file =hiresDirectory+"BK/NotSheetMusic/aeu.ark+=13960=t2q53nq6w-6.png"; 216 219 //String default_file =hiresDirectory+"BK/NotSheetMusic/aeu.ark+=13960=t9z03w65z-4.png"; 217 //String default_file =hiresDirectory+"MU/NotSheetMusic/aeu.ark+=13960=t0dv28v9r-1.png";220 String default_file =hiresDirectory+"MU/NotSheetMusic/aeu.ark+=13960=t0dv28v9r-1.png"; 218 221 219 222 //System.out.println(default_file); … … 395 398 396 399 Mat test = original.clone(); 400 397 401 showWaitDestroy("00 Inverse Binarized Original", test); 402 403 //remove large items of no interest pre proc 404 //denoize 405 //heal 406 //fnd large images, write to a seperate mat. 407 //draw these onto orignal image(binerized) in red 408 //turn all red pixels in image to black 409 410 411 //denoize 412 Mat denoize = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(3,3)); 413 Imgproc.morphologyEx(test,test, Imgproc.MORPH_OPEN, denoize); 414 showWaitDestroy("Denoize", test); 415 416 //close up gaps 417 Mat gapcloser = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(3,3)); 418 Imgproc.morphologyEx(test,test,Imgproc.MORPH_CLOSE, gapcloser); 419 showWaitDestroy("gap closer", test); 420 421 Mat kernelRemoveLarge = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(5, 50)); 422 Imgproc.erode(test,test, kernelRemoveLarge); 423 showWaitDestroy("Remove Large", test); 424 425 //start staff line detection 398 426 399 427 Mat kernelErode = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(10,1)); … … 454 482 int vert = original.height(); 455 483 //Find ratio between 100 and width and 100 and height 456 int sizeX100 = (hori/68) * 10;457 int sizeY100 = (vert/46) * 10;484 int sizeX100 = 10 * (hori/68); 485 int sizeY100 = 10 * (vert/46); 458 486 int sizeX10 = (hori/68); 459 487 int sizeY10 = (vert/46); 460 int sizeX1 = (hori/ 46)/10;488 int sizeX1 = (hori/68)/10; 461 489 int sizeY1 = (vert/46)/10; 462 490 … … 471 499 showWaitDestroy("00 Inverse Binarized Original", test); 472 500 501 //Remove very large and wide black spaces (8th of the page) 502 //Mat kernelRemoveLarge = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(hori/8, vert/8)); 503 //Imgproc.erode(test,test, kernelRemoveLarge); 504 //showWaitDestroy("Remove Large", test); 505 506 //Eliminate things that are not long and thin 473 507 Mat kernelErode = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(sizeX10,sizeY1)); //new Size(10,1)); 474 508 Imgproc.erode(test,test,kernelErode); … … 479 513 showWaitDestroy("02 Dilate", test); 480 514 481 Mat kernel Opening= Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(sizeX1*4,sizeY1*4)); //new Size(4,4));482 Imgproc.morphologyEx(test, test, Imgproc.MORPH_CLOSE, kernel Opening);515 Mat kernelClose = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(sizeX1*4,sizeY1*4)); //new Size(4,4)); 516 Imgproc.morphologyEx(test, test, Imgproc.MORPH_CLOSE, kernelClose); 483 517 showWaitDestroy("03 Open", test); 484 518 … … 522 556 showWaitDestroy("Contours", drawing); 523 557 } 524 558 //ADD PRE PROC 559 560 //USE stuc element, to rule out large wide and long pieces of black and white. 525 561 526 562 -
other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaAccuracyCalculator.java
r33437 r33439 111 111 + "SheetMusicAccuracyRate: " + trueAccuracyRate + "%" + '\n' 112 112 + "NotSheetMusicAccuracyRate: " + falseAccuracyRate + "%" + '\n' 113 + "OverallAccuracyRate: " + overallAccuracyRate + "%" + '\n' + '\n'); 113 + "OverallAccuracyRate: " + overallAccuracyRate + "%" + '\n' + 114 "****************************************************************" + '\n'); 114 115 buf.close(); 115 116 fw.close(); -
other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaClassifierComparison.java
r33437 r33439 8 8 import java.awt.image.BufferedImage; 9 9 import java.awt.image.DataBufferByte; 10 import java.io.FileInputStream; 11 import java.io.IOException; 10 12 //import java.io.File; 11 13 //import java.io.BufferedWriter; … … 16 18 //import java.util.Collections.*; 17 19 import java.util.*; 20 //import java.util.Properties; 18 21 import java.lang.*; 19 22 import java.io.*; … … 34 37 //False =classifierType + 0 + Filename + Status 35 38 public class javaClassifierComparison { 36 37 //MAKE THIS A PROPERTIES FILE. THIS WILL BE SET AND CHECKED FROM OUTSIDE THE LOOP 38 //GLOBALS Constants 39 40 //******************************************************************************************* 41 //GLOBALS 42 //******************************************************************************************* 43 /* 44 //HOUGHLINE 39 45 static int CLASSIFIER_HOUGHLINESP_MIN = 10; 40 46 static int CLASSIFIER_HOUGHLINESP_MAX = 65; … … 50 56 static double THRESHOLD_AREA_SIZE = 1000; 51 57 static double THRESHOLD_AREA_COUNT = 4; 52 53 58 */ 59 static int CLASSIFIER_HOUGHLINESP_MIN; 60 static int CLASSIFIER_HOUGHLINESP_MAX; 61 static int HOUGHLINEP_THRESHOLD; 62 static int STANDARD_DEVIATION_THRESHOLD; 63 static int MINLINECOUNT; 64 static int MAXLINEGAP; 65 static double THRESHOLD_C; 66 static double SLOPEGRADIENT; 67 static double CLUSTER_DISTANCE_MAX; 68 static double CLUSTER_DISTANCE_MIN; 69 //MORPHOLOGY 70 static double THRESHOLD_AREA_SIZE; 71 static double THRESHOLD_AREA_COUNT; 72 73 //******************************************************************************************** 74 //CLASSES 75 //******************************************************************************************** 76 77 //Sets globals based off properties file 78 public static void init(){ 79 try{ 80 Properties config = new Properties(); 81 FileInputStream input = new FileInputStream("configClassifierComparison.properties"); 82 config.load(input); 83 CLASSIFIER_HOUGHLINESP_MIN = Integer.parseInt(config.getProperty("CLASSIFIER_HOUGHLINESP_MIN")); 84 CLASSIFIER_HOUGHLINESP_MAX = Integer.parseInt(config.getProperty("CLASSIFIER_HOUGHLINESP_MAX")); 85 HOUGHLINEP_THRESHOLD = Integer.parseInt(config.getProperty("HOUGHLINEP_THRESHOLD")); 86 STANDARD_DEVIATION_THRESHOLD = Integer.parseInt(config.getProperty("STANDARD_DEVIATION_THRESHOLD")); 87 MINLINECOUNT = Integer.parseInt(config.getProperty("MINLINECOUNT")); 88 MAXLINEGAP = Integer.parseInt(config.getProperty("MAXLINEGAP")); 89 THRESHOLD_C = Double.parseDouble(config.getProperty("THRESHOLD_C")); 90 SLOPEGRADIENT = Double.parseDouble(config.getProperty("SLOPEGRADIENT")); 91 CLUSTER_DISTANCE_MAX = Double.parseDouble(config.getProperty("CLUSTER_DISTANCE_MAX")); 92 CLUSTER_DISTANCE_MIN = Double.parseDouble(config.getProperty("CLUSTER_DISTANCE_MIN")); 93 THRESHOLD_AREA_SIZE = Double.parseDouble(config.getProperty("THRESHOLD_AREA_SIZE")); 94 THRESHOLD_AREA_COUNT = Double.parseDouble(config.getProperty("THRESHOLD_AREA_COUNT")); 95 } 96 catch(Exception e){ 97 e.printStackTrace(); 98 } 99 } 100 54 101 static public class StartAndEndPoint { 55 102 //PRIVATES … … 114 161 115 162 public static void main(String[] args) { 163 init(); 116 164 try { 165 117 166 if (args.length != 3) { 118 167 System.out.println("Usage: imageClassifier <inputFilename> <classifierType> <outputFilename>"); … … 134 183 //Split output by tab for processing in next java program 135 184 //imageFilename = 1, result = 3, classifierType = 4 185 136 186 switch (classifierType) { 137 187 case "count": … … 156 206 System.out.println("unknown algorithm"); 157 207 break; 158 } 208 } 209 159 210 bw.close(); 160 211 }
Note:
See TracChangeset
for help on using the changeset viewer.