Changeset 33439

Show
Ignore:
Timestamp:
28.08.2019 17:03:18 (3 weeks ago)
Author:
cpb16
Message:

Have created properties file and accessibility from javaClassifierComparision. Have created download middle page only variant of image-downloader system. Have created EndToEndSystem? bash script that will be used as makefile, with makefile being used to execute preset useful commands to the EndToEndSystem?. It needs to be fleshed out as only has one script, this script can run a classifier and place the results into a subdirectory defined by the user

Location:
other-projects/is-sheet-music-encore/trunk
Files:
5 added
7 modified

Legend:

Unmodified
Added
Removed
  • other-projects/is-sheet-music-encore/trunk/Makefile

    r33437 r33439  
    22#Utilities/Test 
    33#********** 
     4hi-res-download-map-middle: 
     5    ./COMPX520-DOWNLOADER-MIDDLE-PNG.sh java-gen-corpus/MapListNumPages.txt MP 
    46 
    57compile: 
     
    7880    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 
    7981    #Calculate accuracy 
     82    cd image-identification-terminal; echo configClassifierComparison.properties >> log-all-hires-new/results.txt  
    8083    cd image-identification-terminal; java javaAccuracyCalculator log-all-hires-new/log-cluster-MU.txt cluster-MU log-all-hires-new/results.txt 
    8184    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  
    4040        <entry file="file://$PROJECT_DIR$/image-identification-development/src/MainMorph.java"> 
    4141          <provider selected="true" editor-type-id="text-editor"> 
    42             <state relative-caret-position="2976"> 
    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" /> 
    4444              <folding> 
    4545                <element signature="imports" expanded="true" /> 
    4646                <element signature="class#StartAndEndPoint#0;class#MainMorph#0" /> 
    4747                <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" /> 
    5452              </folding> 
    5553            </state> 
     
    6058        <entry file="file://$PROJECT_DIR$/../image-identification-terminal/javaClassifierComparison.java"> 
    6159          <provider selected="true" editor-type-id="text-editor"> 
    62             <state relative-caret-position="1123"> 
    63               <caret line="305" 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" /> 
    6462              <folding> 
    6563                <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" /> 
    6964                <element signature="method#Algorithm_HoughLinesP_Single#0;class#javaClassifierComparison#0" /> 
    7065                <element signature="method#Algorithm_HoughLinesP_Combo#0;class#javaClassifierComparison#0" /> 
    71                 <element signature="e#11894#11906#0" expanded="true" /> 
    7266                <element signature="method#Classifier_LineCounter#0;class#javaClassifierComparison#0" /> 
    7367                <element signature="method#Classifier_ClusterDetection#0;class#javaClassifierComparison#0" /> 
    7468                <element signature="method#removeDuplicates#0;class#javaClassifierComparison#0" /> 
    75                 <element signature="e#17563#18162#1" /> 
    7669                <element signature="method#lineComparison#0;class#javaClassifierComparison#0" /> 
    7770                <element signature="method#ClusterCheck#0;class#javaClassifierComparison#0" /> 
     
    174167  <component name="ToolWindowManager"> 
    175168    <frame x="67" y="25" width="1613" height="1025" extended-state="6" /> 
     169    <editor active="true" /> 
    176170    <layout> 
    177171      <window_info content_ui="combo" id="Project" order="0" weight="0.19783024" /> 
     
    182176      <window_info anchor="bottom" id="Message" order="0" /> 
    183177      <window_info anchor="bottom" id="Find" order="1" /> 
    184       <window_info anchor="bottom" id="Run" order="2" weight="0.2494432" /> 
     178      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.2494432" /> 
    185179      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> 
    186180      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> 
     
    252246    <entry file="file://$PROJECT_DIR$/../image-identification-terminal/javaClassifierComparison.java"> 
    253247      <provider selected="true" editor-type-id="text-editor"> 
    254         <state relative-caret-position="1123"> 
    255           <caret line="305" 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" /> 
    256250          <folding> 
    257251            <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" /> 
    261252            <element signature="method#Algorithm_HoughLinesP_Single#0;class#javaClassifierComparison#0" /> 
    262253            <element signature="method#Algorithm_HoughLinesP_Combo#0;class#javaClassifierComparison#0" /> 
    263             <element signature="e#11894#11906#0" expanded="true" /> 
    264254            <element signature="method#Classifier_LineCounter#0;class#javaClassifierComparison#0" /> 
    265255            <element signature="method#Classifier_ClusterDetection#0;class#javaClassifierComparison#0" /> 
    266256            <element signature="method#removeDuplicates#0;class#javaClassifierComparison#0" /> 
    267             <element signature="e#17563#18162#1" /> 
    268257            <element signature="method#lineComparison#0;class#javaClassifierComparison#0" /> 
    269258            <element signature="method#ClusterCheck#0;class#javaClassifierComparison#0" /> 
     
    274263    <entry file="file://$PROJECT_DIR$/image-identification-development/src/MainMorph.java"> 
    275264      <provider selected="true" editor-type-id="text-editor"> 
    276         <state relative-caret-position="2976"> 
    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" /> 
    278267          <folding> 
    279268            <element signature="imports" expanded="true" /> 
    280269            <element signature="class#StartAndEndPoint#0;class#MainMorph#0" /> 
    281270            <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" /> 
    288275          </folding> 
    289276        </state> 
  • other-projects/is-sheet-music-encore/trunk/image-identification-dev-02/image-identification-development/src/MainMorph.java

    r33437 r33439  
    193193 
    194194        try { 
     195 
    195196            ArrayList<StartAndEndPoint> pointArrayList = new ArrayList<>(); 
    196197 
    197198            //Variables 
    198             int codeVersion = 5; 
     199            int codeVersion = 4; 
     200            System.out.println("Running code version: " + codeVersion); 
    199201            Mat edgesDetected = new Mat(); 
    200202            Mat mid = new Mat(); 
    201203            Mat edgesDetectedRGB = new Mat(); 
    202204            Mat clustersFoundRGB = new Mat(); 
     205 
    203206            String testDirectory = "/Scratch/cpb16/is-sheet-music-encore/image-identification-dev-02/image-identification-development/"; 
    204207            String directory = "/Scratch/cpb16/is-sheet-music-encore/download-images/MU/"; 
     
    215218            //String default_file =hiresDirectory+"BK/NotSheetMusic/aeu.ark+=13960=t2q53nq6w-6.png"; 
    216219            //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"; 
    218221 
    219222            //System.out.println(default_file); 
     
    395398 
    396399                Mat test = original.clone(); 
     400 
    397401                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 
    398426 
    399427                Mat kernelErode = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(10,1)); 
     
    454482                int vert = original.height(); 
    455483                //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); 
    458486                int sizeX10 = (hori/68); 
    459487                int sizeY10 = (vert/46); 
    460                 int sizeX1 = (hori/46)/10; 
     488                int sizeX1 = (hori/68)/10; 
    461489                int sizeY1 = (vert/46)/10; 
    462490 
     
    471499                showWaitDestroy("00 Inverse Binarized Original", test); 
    472500 
     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 
    473507                Mat kernelErode = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(sizeX10,sizeY1)); //new Size(10,1)); 
    474508                Imgproc.erode(test,test,kernelErode); 
     
    479513                showWaitDestroy("02 Dilate", test); 
    480514 
    481                 Mat kernelOpening = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(sizeX1*4,sizeY1*4)); //new Size(4,4)); 
    482                 Imgproc.morphologyEx(test, test, Imgproc.MORPH_CLOSE, kernelOpening); 
     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); 
    483517                showWaitDestroy("03 Open", test); 
    484518 
     
    522556                showWaitDestroy("Contours", drawing); 
    523557            } 
    524  
     558            //ADD PRE PROC 
     559 
     560            //USE stuc element, to rule out large wide and long pieces of black and white. 
    525561 
    526562 
  • other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaAccuracyCalculator.java

    r33437 r33439  
    111111                    + "SheetMusicAccuracyRate: "    + trueAccuracyRate + "%" + '\n' 
    112112                    + "NotSheetMusicAccuracyRate: " + falseAccuracyRate + "%" + '\n' 
    113                     + "OverallAccuracyRate: "       + overallAccuracyRate + "%" + '\n' + '\n');      
     113                    + "OverallAccuracyRate: "       + overallAccuracyRate + "%" + '\n' + 
     114                    "****************************************************************" + '\n');      
    114115                buf.close(); 
    115116                fw.close();                              
  • other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaClassifierComparison.java

    r33437 r33439  
    88import java.awt.image.BufferedImage; 
    99import java.awt.image.DataBufferByte; 
     10import java.io.FileInputStream; 
     11import java.io.IOException; 
    1012//import java.io.File; 
    1113//import java.io.BufferedWriter; 
     
    1618//import java.util.Collections.*; 
    1719import java.util.*; 
     20//import java.util.Properties; 
    1821import java.lang.*; 
    1922import java.io.*; 
     
    3437//False =classifierType + 0 + Filename + Status 
    3538public 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 
    3945    static int CLASSIFIER_HOUGHLINESP_MIN = 10; 
    4046    static int CLASSIFIER_HOUGHLINESP_MAX = 65; 
     
    5056    static double THRESHOLD_AREA_SIZE  = 1000; 
    5157    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     
    54101    static public class StartAndEndPoint { 
    55102        //PRIVATES 
     
    114161 
    115162    public static void main(String[] args) { 
     163        init(); 
    116164        try { 
     165         
    117166            if (args.length != 3) { 
    118167                System.out.println("Usage: imageClassifier <inputFilename> <classifierType> <outputFilename>"); 
     
    134183                //Split output by tab for processing in next java program 
    135184                //imageFilename = 1, result = 3, classifierType = 4 
     185                 
    136186                switch (classifierType) { 
    137187                    case "count": 
     
    156206                        System.out.println("unknown algorithm"); 
    157207                        break; 
    158                 } 
     208                }      
     209                 
    159210                bw.close(); 
    160211            }