Changeset 33304 for other-projects

Show
Ignore:
Timestamp:
06.07.2019 15:45:02 (6 weeks ago)
Author:
cpb16
Message:

Backup for computer crash, only lost 5 lines of code in development section. They have been rewritten.

Location:
other-projects/is-sheet-music-encore/trunk
Files:
8 modified

Legend:

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

    r33243 r33304  
    125125    cd image-identification-terminal; less results.txt 
    126126 
    127 run-all: 
     127run-both-MU: 
    128128        #Compile 
    129129    cd image-identification-terminal; javac javaAccuracyCalculator.java 
     
    147147    cd image-identification-terminal; less log-houghlinesP-refined-MU.txt 
    148148 
     149run-houghlineP-refined-corpus: 
     150    cd image-identification-terminal; cd log-all; rm *.txt 
     151        #Compile 
     152    cd image-identification-terminal; javac javaAccuracyCalculator.java 
     153    cd image-identification-terminal; javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaImageClassifier.java; 
     154        #Run javaImageClassifier on all images in Corpus 
     155    cd image-identification-terminal; ./runClassifer.sh /Scratch/cpb16/is-sheet-music-encore/download-images/MU houghlinesP-refined log-all/log-houghlinesP-refined-MU.txt -all 
     156    cd image-identification-terminal; ./runClassifer.sh /Scratch/cpb16/is-sheet-music-encore/download-images/BK houghlinesP-refined log-all/log-houghlinesP-refined-BK.txt -all 
     157    cd image-identification-terminal; ./runClassifer.sh /Scratch/cpb16/is-sheet-music-encore/download-images/MP houghlinesP-refined log-all/log-houghlinesP-refined-MP.txt -all 
     158    cd image-identification-terminal; ./runClassifer.sh /Scratch/cpb16/is-sheet-music-encore/download-images/SE houghlinesP-refined log-all/log-houghlinesP-refined-SE.txt -all 
     159        #Calculate the Accuracy of the classifier 
     160    cd image-identification-terminal; java javaAccuracyCalculator log-all/log-houghlinesP-refined-MU.txt houghlinesP-refined-MU log-all/results.txt 
     161    cd image-identification-terminal; java javaAccuracyCalculator log-all/log-houghlinesP-refined-BK.txt houghlinesP-refined-BK log-all/results.txt 
     162    cd image-identification-terminal; java javaAccuracyCalculator log-all/log-houghlinesP-refined-MP.txt houghlinesP-refined-MP log-all/results.txt 
     163    cd image-identification-terminal; java javaAccuracyCalculator log-all/log-houghlinesP-refined-SE.txt houghlinesP-refined-SE log-all/results.txt 
     164        #Display the results 
     165    cd image-identification-terminal; less log-all/results.txt 
     166 
  • other-projects/is-sheet-music-encore/trunk/image-identification-development/.idea/workspace.xml

    r33243 r33304  
    2020        <entry file="file://$PROJECT_DIR$/src/Main.java"> 
    2121          <provider selected="true" editor-type-id="text-editor"> 
    22             <state relative-caret-position="-810"> 
    23               <caret line="126" column="37" lean-forward="true" selection-start-line="126" selection-start-column="37" selection-end-line="126" selection-end-column="37" /> 
     22            <state relative-caret-position="801"> 
     23              <caret line="326" selection-start-line="326" selection-end-line="326" /> 
    2424              <folding> 
    2525                <element signature="imports" expanded="true" /> 
     26                <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     27                <element signature="method#removeDuplicates#0;class#Main#0" /> 
     28                <element signature="method#StandardDeviation#0;class#Main#0" /> 
     29                <element signature="method#toBufferedImage#0;class#Main#0" /> 
     30                <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     31                <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     32                <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     33                <element signature="e#7430#7439#0" expanded="true" /> 
    2634              </folding> 
    2735            </state> 
     
    3442    <findStrings> 
    3543      <find>aeu.ark+=13960=t93787r1w-10.png</find> 
     44      <find>returnArray</find> 
    3645    </findStrings> 
    3746  </component> 
     
    4453  </component> 
    4554  <component name="ProjectFrameBounds" extendedState="6"> 
    46     <option name="x" value="992" /> 
     55    <option name="x" value="65" /> 
    4756    <option name="y" value="24" /> 
    4857    <option name="width" value="928" /> 
     
    133142  <component name="ToolWindowManager"> 
    134143    <frame x="65" y="24" width="1855" height="1056" extended-state="6" /> 
    135     <editor active="true" /> 
    136144    <layout> 
    137145      <window_info anchor="right" id="Palette" order="4" /> 
    138146      <window_info anchor="bottom" id="TODO" order="10" /> 
    139       <window_info anchor="bottom" id="Messages" order="3" weight="0.32842106" /> 
    140147      <window_info anchor="right" id="Palette&#9;" order="1" /> 
    141148      <window_info id="Image Layers" order="4" /> 
     
    143150      <window_info anchor="bottom" id="Event Log" order="1" side_tool="true" /> 
    144151      <window_info anchor="right" id="Maven Projects" order="3" /> 
    145       <window_info active="true" anchor="bottom" id="Run" order="6" visible="true" weight="0.21881391" /> 
    146152      <window_info anchor="bottom" id="Version Control" order="2" /> 
     153      <window_info anchor="bottom" id="Run" order="6" weight="0.22392638" /> 
    147154      <window_info anchor="bottom" id="Terminal" order="0" weight="0.42638037" /> 
    148155      <window_info id="Capture Tool" order="2" /> 
     
    153160      <window_info id="UI Designer" order="1" /> 
    154161      <window_info anchor="right" id="Theme Preview" order="2" /> 
     162      <window_info id="Favorites" order="3" side_tool="true" /> 
    155163      <window_info anchor="bottom" id="Debug" order="7" weight="0.39894736" /> 
    156       <window_info id="Favorites" order="3" side_tool="true" /> 
    157164      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="7" weight="0.25" /> 
    158165      <window_info anchor="bottom" id="Inspection" order="9" weight="0.4" /> 
     
    162169      <window_info anchor="bottom" id="Cvs" order="8" weight="0.25" /> 
    163170      <window_info anchor="bottom" id="Find" order="5" weight="0.32924336" /> 
     171      <window_info anchor="bottom" id="Messages" order="3" weight="0.32822084" /> 
    164172    </layout> 
    165173    <layout-to-restore> 
     
    197205  <component name="XDebuggerManager"> 
    198206    <breakpoint-manager> 
    199       <option name="time" value="3" /> 
     207      <option name="time" value="4" /> 
    200208    </breakpoint-manager> 
    201209  </component> 
    202210  <component name="editorHistoryManager"> 
     211    <entry file="file://$PROJECT_DIR$/src/Main.java"> 
     212      <provider selected="true" editor-type-id="text-editor"> 
     213        <state relative-caret-position="4770"> 
     214          <caret line="318" column="55" selection-start-line="318" selection-start-column="55" selection-end-line="318" selection-end-column="55" /> 
     215          <folding> 
     216            <element signature="imports" expanded="true" /> 
     217            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     218            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     219            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     220            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     221            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     222            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     223            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     224            <element signature="e#7430#7439#0" expanded="true" /> 
     225          </folding> 
     226        </state> 
     227      </provider> 
     228    </entry> 
     229    <entry file="file://$PROJECT_DIR$/src/Main.java"> 
     230      <provider selected="true" editor-type-id="text-editor"> 
     231        <state relative-caret-position="3600"> 
     232          <caret line="240" selection-start-line="240" selection-end-line="240" /> 
     233          <folding> 
     234            <element signature="imports" expanded="true" /> 
     235            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     236            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     237            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     238            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     239            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     240            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     241            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     242            <element signature="e#7430#7439#0" expanded="true" /> 
     243          </folding> 
     244        </state> 
     245      </provider> 
     246    </entry> 
     247    <entry file="file://$PROJECT_DIR$/src/Main.java"> 
     248      <provider selected="true" editor-type-id="text-editor"> 
     249        <state relative-caret-position="2730"> 
     250          <caret line="182" column="44" lean-forward="true" selection-start-line="182" selection-start-column="44" selection-end-line="182" selection-end-column="44" /> 
     251          <folding> 
     252            <element signature="imports" expanded="true" /> 
     253            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     254            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     255            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     256            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     257            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     258            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     259            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     260            <element signature="e#7430#7439#0" expanded="true" /> 
     261          </folding> 
     262        </state> 
     263      </provider> 
     264    </entry> 
     265    <entry file="file://$PROJECT_DIR$/src/Main.java"> 
     266      <provider selected="true" editor-type-id="text-editor"> 
     267        <state relative-caret-position="2130"> 
     268          <caret line="142" column="30" selection-start-line="142" selection-start-column="30" selection-end-line="142" selection-end-column="30" /> 
     269          <folding> 
     270            <element signature="imports" expanded="true" /> 
     271            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     272            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     273            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     274            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     275            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     276            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     277            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     278            <element signature="e#7430#7439#0" expanded="true" /> 
     279          </folding> 
     280        </state> 
     281      </provider> 
     282    </entry> 
     283    <entry file="file://$PROJECT_DIR$/src/Main.java"> 
     284      <provider selected="true" editor-type-id="text-editor"> 
     285        <state relative-caret-position="2025"> 
     286          <caret line="135" column="56" lean-forward="true" selection-start-line="135" selection-start-column="56" selection-end-line="135" selection-end-column="56" /> 
     287          <folding> 
     288            <element signature="imports" expanded="true" /> 
     289            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     290            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     291            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     292            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     293            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     294            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     295            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     296            <element signature="e#7430#7439#0" expanded="true" /> 
     297          </folding> 
     298        </state> 
     299      </provider> 
     300    </entry> 
     301    <entry file="file://$PROJECT_DIR$/src/Main.java"> 
     302      <provider selected="true" editor-type-id="text-editor"> 
     303        <state relative-caret-position="1890"> 
     304          <caret line="126" column="37" lean-forward="true" selection-start-line="126" selection-start-column="37" selection-end-line="126" selection-end-column="37" /> 
     305          <folding> 
     306            <element signature="imports" expanded="true" /> 
     307            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     308            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     309            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     310            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     311            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     312            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     313            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     314            <element signature="e#7430#7439#0" expanded="true" /> 
     315          </folding> 
     316        </state> 
     317      </provider> 
     318    </entry> 
    203319    <entry file="file://$PROJECT_DIR$/src/Main.java"> 
    204320      <provider selected="true" editor-type-id="text-editor"> 
     
    207323          <folding> 
    208324            <element signature="imports" expanded="true" /> 
     325            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     326            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     327            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     328            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     329            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     330            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     331            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     332            <element signature="e#7430#7439#0" expanded="true" /> 
    209333          </folding> 
    210334        </state> 
     
    217341          <folding> 
    218342            <element signature="imports" expanded="true" /> 
     343            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     344            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     345            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     346            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     347            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     348            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     349            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     350            <element signature="e#7430#7439#0" expanded="true" /> 
    219351          </folding> 
    220352        </state> 
     
    227359          <folding> 
    228360            <element signature="imports" expanded="true" /> 
     361            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     362            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     363            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     364            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     365            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     366            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     367            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     368            <element signature="e#7430#7439#0" expanded="true" /> 
    229369          </folding> 
    230370        </state> 
     
    237377          <folding> 
    238378            <element signature="imports" expanded="true" /> 
     379            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     380            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     381            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     382            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     383            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     384            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     385            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     386            <element signature="e#7430#7439#0" expanded="true" /> 
    239387          </folding> 
    240388        </state> 
     
    247395          <folding> 
    248396            <element signature="imports" expanded="true" /> 
     397            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     398            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     399            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     400            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     401            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     402            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     403            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     404            <element signature="e#7430#7439#0" expanded="true" /> 
    249405          </folding> 
    250406        </state> 
     
    257413          <folding> 
    258414            <element signature="imports" expanded="true" /> 
     415            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     416            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     417            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     418            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     419            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     420            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     421            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     422            <element signature="e#7430#7439#0" expanded="true" /> 
    259423          </folding> 
    260424        </state> 
     
    267431          <folding> 
    268432            <element signature="imports" expanded="true" /> 
     433            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     434            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     435            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     436            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     437            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     438            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     439            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     440            <element signature="e#7430#7439#0" expanded="true" /> 
    269441          </folding> 
    270442        </state> 
     
    277449          <folding> 
    278450            <element signature="imports" expanded="true" /> 
     451            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     452            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     453            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     454            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     455            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     456            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     457            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     458            <element signature="e#7430#7439#0" expanded="true" /> 
    279459          </folding> 
    280460        </state> 
     
    287467          <folding> 
    288468            <element signature="imports" expanded="true" /> 
     469            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     470            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     471            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     472            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     473            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     474            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     475            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     476            <element signature="e#7430#7439#0" expanded="true" /> 
    289477          </folding> 
    290478        </state> 
     
    297485          <folding> 
    298486            <element signature="imports" expanded="true" /> 
     487            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     488            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     489            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     490            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     491            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     492            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     493            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     494            <element signature="e#7430#7439#0" expanded="true" /> 
    299495          </folding> 
    300496        </state> 
     
    307503          <folding> 
    308504            <element signature="imports" expanded="true" /> 
     505            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     506            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     507            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     508            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     509            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     510            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     511            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     512            <element signature="e#7430#7439#0" expanded="true" /> 
    309513          </folding> 
    310514        </state> 
     
    317521          <folding> 
    318522            <element signature="imports" expanded="true" /> 
     523            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     524            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     525            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     526            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     527            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     528            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     529            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     530            <element signature="e#7430#7439#0" expanded="true" /> 
    319531          </folding> 
    320532        </state> 
     
    327539          <folding> 
    328540            <element signature="imports" expanded="true" /> 
     541            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     542            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     543            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     544            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     545            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     546            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     547            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     548            <element signature="e#7430#7439#0" expanded="true" /> 
    329549          </folding> 
    330550        </state> 
     
    337557          <folding> 
    338558            <element signature="imports" expanded="true" /> 
     559            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     560            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     561            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     562            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     563            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     564            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     565            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     566            <element signature="e#7430#7439#0" expanded="true" /> 
    339567          </folding> 
    340568        </state> 
     
    347575          <folding> 
    348576            <element signature="imports" expanded="true" /> 
     577            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     578            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     579            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     580            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     581            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     582            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     583            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     584            <element signature="e#7430#7439#0" expanded="true" /> 
    349585          </folding> 
    350586        </state> 
     
    357593          <folding> 
    358594            <element signature="imports" expanded="true" /> 
     595            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     596            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     597            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     598            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     599            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     600            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     601            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     602            <element signature="e#7430#7439#0" expanded="true" /> 
    359603          </folding> 
    360604        </state> 
     
    367611          <folding> 
    368612            <element signature="imports" expanded="true" /> 
     613            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     614            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     615            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     616            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     617            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     618            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     619            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     620            <element signature="e#7430#7439#0" expanded="true" /> 
    369621          </folding> 
    370622        </state> 
     
    377629          <folding> 
    378630            <element signature="imports" expanded="true" /> 
     631            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     632            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     633            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     634            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     635            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     636            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     637            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     638            <element signature="e#7430#7439#0" expanded="true" /> 
    379639          </folding> 
    380640        </state> 
     
    387647          <folding> 
    388648            <element signature="imports" expanded="true" /> 
     649            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     650            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     651            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     652            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     653            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     654            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     655            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     656            <element signature="e#7430#7439#0" expanded="true" /> 
    389657          </folding> 
    390658        </state> 
     
    397665          <folding> 
    398666            <element signature="imports" expanded="true" /> 
     667            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     668            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     669            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     670            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     671            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     672            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     673            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     674            <element signature="e#7430#7439#0" expanded="true" /> 
    399675          </folding> 
    400676        </state> 
     
    407683          <folding> 
    408684            <element signature="imports" expanded="true" /> 
     685            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     686            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     687            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     688            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     689            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     690            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     691            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     692            <element signature="e#7430#7439#0" expanded="true" /> 
    409693          </folding> 
    410694        </state> 
     
    418702      </provider> 
    419703    </entry> 
    420     <entry file="file://$PROJECT_DIR$/src/Main.java"> 
    421       <provider selected="true" editor-type-id="text-editor"> 
    422         <state relative-caret-position="-810"> 
    423           <caret line="126" column="37" lean-forward="true" selection-start-line="126" selection-start-column="37" selection-end-line="126" selection-end-column="37" /> 
    424           <folding> 
    425             <element signature="imports" expanded="true" /> 
     704    <entry file="jar:///usr/lib/jvm/java-8-oracle/src.zip!/java/lang/Object.java"> 
     705      <provider selected="true" editor-type-id="text-editor"> 
     706        <state relative-caret-position="238"> 
     707          <caret line="234" column="18" selection-start-line="234" selection-start-column="18" selection-end-line="234" selection-end-column="18" /> 
     708          <folding> 
     709            <element signature="e#10065#10066#0" expanded="true" /> 
     710            <element signature="e#10148#10149#0" expanded="true" /> 
     711          </folding> 
     712        </state> 
     713      </provider> 
     714    </entry> 
     715    <entry file="file://$PROJECT_DIR$/src/Main.java"> 
     716      <provider selected="true" editor-type-id="text-editor"> 
     717        <state relative-caret-position="801"> 
     718          <caret line="326" selection-start-line="326" selection-end-line="326" /> 
     719          <folding> 
     720            <element signature="imports" expanded="true" /> 
     721            <element signature="class#StartAndEndPoint#0;class#Main#0" /> 
     722            <element signature="method#removeDuplicates#0;class#Main#0" /> 
     723            <element signature="method#StandardDeviation#0;class#Main#0" /> 
     724            <element signature="method#toBufferedImage#0;class#Main#0" /> 
     725            <element signature="method#ClassifierPixelCount#0;class#Main#0" /> 
     726            <element signature="method#ClassifierLineCount#0;class#Main#0" /> 
     727            <element signature="method#ClassifierLineClusterOLD#0;class#Main#0" /> 
     728            <element signature="e#7430#7439#0" expanded="true" /> 
    426729          </folding> 
    427730        </state> 
  • other-projects/is-sheet-music-encore/trunk/image-identification-development/src/Main.java

    r33243 r33304  
    1010import java.io.File; 
    1111import java.util.ArrayList; 
     12import java.util.Collection; 
     13import java.util.Collections; 
    1214import javax.imageio.ImageIO; 
    1315 
     
    1719//https://www.wikihow.com/Calculate-Percentage-in-Java 
    1820//https://riptutorial.com/opencv/example/21963/converting-an-mat-object-to-an-bufferedimage-object 
     21//https://beginnersbook.com/2013/12/java-arraylist-of-object-sort-example-comparable-and-comparator/ 
     22//https://www.programiz.com/java-programming/examples/standard-deviation 
     23//https://www.geeksforgeeks.org/how-to-remove-duplicates-from-arraylist-in-java/ 
     24 
    1925 
    2026 
     
    3844public class Main { 
    3945 
     46    //DEPENDENT FUNCTIONS AND CLASSES 
     47    static class StartAndEndPoint { 
     48        //PRIVATES 
     49        private Point _p1; 
     50        private Point _p2; 
     51        //CONSTRUCTOR 
     52        public StartAndEndPoint(Point p1, Point p2){ 
     53            _p1 = p1; 
     54            _p2 = p2; 
     55        } 
     56        //GETTERS 
     57        public Point getP1(){ 
     58            return _p1; 
     59        } 
     60        public Point getP2(){ 
     61            return  _p2; 
     62        } 
     63        //SETTERS 
     64        public void setP1(Point p1){ 
     65            _p1 = p1; 
     66        } 
     67        public void setP2(Point p2){ 
     68            _p2 = p2; 
     69        } 
     70 
     71        //ToString 
     72        public  String toString(){ 
     73            return "Start: " + _p1 + " End: " + _p2; 
     74        } 
     75        /* 
     76        //CompareToOverride 
     77        //Compares start point y co ordinates of input PointArray 
     78        //With this. start point y co ordinate 
     79        @Override 
     80        public double compareTo(StartAndEndPoint comparePointArray){ 
     81            Point comparePoint = (comparePointArray.getP1()); 
     82            return (this.getP1().y) - (comparePoint.y); 
     83        } 
     84        */ 
     85    } 
     86    public static <T> ArrayList<T> removeDuplicates(ArrayList<T> list) { 
     87        //DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED 
     88        // Function to remove duplicates from an ArrayList 
     89        // Create a new ArrayList 
     90        ArrayList<T> newList = new ArrayList(); 
     91        // Traverse through the first list 
     92        for (T element : list) { 
     93            // If this element is not present in newList 
     94            // then add it 
     95            if (!newList.contains(element)) { 
     96                newList.add(element); 
     97            } 
     98        } 
     99        // return the new list 
     100        return newList; 
     101        //DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED 
     102    } 
     103    public static double StandardDeviation(double parseArray[]) 
     104    { 
     105        double mean; 
     106        double sum =0; 
     107        double standardDeviation = 0; 
     108        //calculate sum of array 
     109        for(int i =0; i > parseArray.length; i++){ 
     110            sum += parseArray[i]; 
     111        } 
     112        //calculate mean of array 
     113        mean = sum/parseArray.length; 
     114        //calculate SD of array 
     115        for(int j =0; j > parseArray.length; j++){ 
     116            standardDeviation += Math.pow(parseArray[j]-mean, 2); 
     117        } 
     118        return Math.sqrt(standardDeviation/parseArray.length); 
     119    } 
     120 
    40121    //GLOBAL_CONSTANTS 
    41122    static int CLASSIFIER_HOUGHLINESP_MIN   = 10; 
     
    43124    static int HOUGHLINEP_THRESHOLD         = 10; 
    44125    static int MINLINECOUNT                 = 40; 
    45     static double MAXLINEGAP                = 4; 
     126    static double MAXLINEGAP                = 1;  //4 
    46127    static double SLOPEGRADIENT             = 0.02; 
    47128    //SHOULD TURN INTO ARGS 
    48129 
     130    //CLASSIFYING FUNCTIONS 
    49131    private static  BufferedImage toBufferedImage(Mat mat){ 
    50132        //MOSTLY COPY PASTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
     
    100182        return false; 
    101183    } 
    102     private static boolean Classifier(int lineCount){ 
     184    private static boolean ClassifierLineCount(int lineCount){ 
    103185 
    104186           if(lineCount>MINLINECOUNT){ 
     
    109191            } 
    110192    } 
     193    private static ArrayList ClassifierLineClusterOLD(BufferedImage img){ 
     194        ArrayList returnArray = new ArrayList(); 
     195        try { 
     196 
     197            //IF THIS WORKS THEN IMPLEMENT A VERSION THAT USES POINTS from the draw line code. 
     198            //ALSO CHECK OUT K NEAREST NEIGHBOR? 
     199            //0xFFFF0000 = RED 
     200 
     201            //go thru every pixel until find red pixel 
     202            //get y pos of red pixel 
     203            //continue with loop until find another red pixel 
     204            //get y pos of red pixel 
     205            //compare y pos (if close together then continue loop) else break 
     206 
     207            int x = img.getWidth(); 
     208            int y = img.getHeight(); 
     209            int closeLineCount = 0; 
     210            ArrayList<Integer> redPixelYpos = new ArrayList<Integer>(); 
     211 
     212 
     213 
     214            //Go Thru every pixel 
     215            for(int i=0; i < y; i++){ 
     216                for(int j=0;j < x; j++){ 
     217                    //Get value for current pixels RGB value 
     218                    int currPixelRGB = img.getRGB(j, i); 
     219                    //Check if pixel is red (hex value of red) 
     220                    if(currPixelRGB == 0xFFFF0000) { 
     221 
     222                        //Store y pos of red pixel if there is no duplicate 
     223                        if(!redPixelYpos.contains(i)){ 
     224                            redPixelYpos.add(i); 
     225                            //System.out.println(i ); 
     226                        } 
     227                    } 
     228                } 
     229            } 
     230            //Check if any of the lines found are close together and that there has been more than one line found 
     231            if(redPixelYpos.size()>1){ 
     232                //go through list and compare every value 
     233                for(int i =0; i< redPixelYpos.size(); i++){ 
     234                    //System.out.println("i: " +redPixelYpos.get(i)); 
     235                    for(int j=0; j< redPixelYpos.size(); j++){ 
     236                        //System.out.println("j: "+redPixelYpos.get(j)); 
     237                        //Check if difference is less than 4 and the values are not duplicates. 
     238                        if(Math.abs(redPixelYpos.get(i) - redPixelYpos.get(j)) < 4 && !redPixelYpos.get(j).equals(redPixelYpos.get(i))){ 
     239                            closeLineCount++; 
     240                        } 
     241                    } 
     242                } 
     243            } 
     244            int clusterCount = closeLineCount/4; 
     245 
     246            if(closeLineCount >= 4){ 
     247                returnArray.add(true); 
     248                returnArray.add(closeLineCount); 
     249                returnArray.add(clusterCount); 
     250            } 
     251            else{ 
     252                returnArray.add(false); 
     253                returnArray.add(closeLineCount); 
     254                returnArray.add(clusterCount); 
     255            } 
     256        } 
     257        catch (Exception e) { 
     258            System.err.println(e); 
     259        } 
     260    return returnArray; 
     261    } 
     262 
     263    private static ArrayList ClassifierLineCluster(ArrayList<StartAndEndPoint> linePointsArray){ 
     264        ArrayList returnArray = new ArrayList(); 
     265        ArrayList<Double> closeLineYPos = new ArrayList(); 
     266        ArrayList<double[]> clusterArray = new ArrayList(); 
     267        int clusterCount = 0; 
     268        try { 
     269            if(linePointsArray.size()> 1) { 
     270 
     271                //Display input array TESTING PURPOSES 
     272                for (int i = 0; i < linePointsArray.size(); i++) { 
     273                    System.out.println(linePointsArray.get(i).toString()); 
     274                } 
     275 
     276 
     277                //Check if y points are close together 
     278                //go thru list and compare values against each other 
     279                for (int i = 0; i < linePointsArray.size(); i++){ 
     280                    //System.out.println("i: "+ linePointsArray.get(i).getP1().y); 
     281                    for (int j = 0; j < linePointsArray.size(); j++) { 
     282                        //System.out.println("j: "+ linePointsArray.get(j).getP1().y); 
     283                        //Check if difference is less than 4 and the values are not duplicates. 
     284                        if(Math.abs(linePointsArray.get(j).getP1().y - linePointsArray.get(i).getP1().y) < 5){ 
     285                            if(linePointsArray.get(j).getP1().y != linePointsArray.get(i).getP1().y){ 
     286                                closeLineYPos.add(linePointsArray.get(j).getP1().y); 
     287                            } 
     288                        } 
     289                    } 
     290                } 
     291 
     292                System.out.println(" "); 
     293 
     294                //Have all y coordinates that close to each other. 
     295                //Now check if there are four of these are close to each other. 
     296                if(closeLineYPos.size() >= 4) { 
     297                    //Sort array and remove duplicates 
     298                    Collections.sort(closeLineYPos); 
     299                    closeLineYPos = removeDuplicates(closeLineYPos); 
     300 
     301 
     302                   /*for (double num : closeLineYPos){ 
     303                      System.out.println(num); 
     304                   } */ 
     305 
     306 
     307                    //Check first four items, traverse down a step {0,1,2,3} -> {1,2,3,4} -> {2,3,4,5} 
     308                    for(int i= 0; i< closeLineYPos.size(); i++){ 
     309                        //If last comparator is within the array bounds. 
     310                        if(i + 3 == closeLineYPos.size()){ 
     311                            break; 
     312                        } 
     313                        else{ 
     314                            double[] tempArray = new double[4]; 
     315                            tempArray[0] = closeLineYPos.get(i + 0); 
     316                            tempArray[1] = closeLineYPos.get(i + 1); 
     317                            tempArray[2] = closeLineYPos.get(i + 2); 
     318                            tempArray[3] = closeLineYPos.get(i + 3); 
     319                            System.out.println(tempArray[0] + " , " + tempArray[1] + " , " + tempArray[2] + " , " + tempArray[3]); 
     320                            //Check standard deviation 
     321                            if(StandardDeviation(tempArray) < 5){ 
     322                                //Store array 
     323                                clusterArray.add(tempArray); 
     324                                //Check if more than one item in array 
     325                                if(clusterArray.size() > 1){ 
     326                                    //check for duplicate yPos in stored arrays (tempArray) 
     327 
     328                                } 
     329 
     330 
     331                            } 
     332                        } 
     333                    } 
     334 
     335                    //for (double num : closeLineYPos){ 
     336                    //    System.out.println(num); 
     337                    //} 
     338                } 
     339 
     340                //PROBLEM. Definition of cluster. Need to check if cluster. 
     341                //check if four lines are close to each other.(four for loops) 
     342                //  then store these four items in an array and add one to the counter. 
     343                //  (will need to check if found 5th item. - DONT NEED TO? Value gained from finding the 5th line? The staffline height?) 
     344                // 
     345 
     346 
     347 
     348                //SETUP RETURN ARRAY 
     349                if(closeLineYPos.size() >= 4){ 
     350                    returnArray.add(true); 
     351                    returnArray.add(closeLineYPos.size()); 
     352                    returnArray.add(clusterCount); 
     353                } 
     354                else{ 
     355                    returnArray.add(false); 
     356                    returnArray.add(closeLineYPos.size()); 
     357                    returnArray.add(clusterCount); 
     358                } 
     359            } 
     360        } 
     361        catch (Exception e) { 
     362            System.err.println(e); 
     363        } 
     364        return returnArray; 
     365    } 
     366 
    111367 
    112368 
    113369    public static void main(String[] args) { 
     370 
    114371        System.loadLibrary(Core.NATIVE_LIBRARY_NAME); 
     372 
    115373        try { 
    116             //temp array for terminalversion 
    117  
    118             ArrayList returnArray = new ArrayList(); 
    119             returnArray.add(true); 
    120             returnArray.add(10); 
    121  
     374            ArrayList<StartAndEndPoint> pointArrayList = new ArrayList<>(); 
    122375 
    123376            //Variables 
    124377            Mat edgesDetected = new Mat(); 
    125378            Mat edgesDetectedRGB = new Mat(); 
    126             Mat edgesExtra = new Mat(); 
    127             Mat edgesDetectedRGBProb; 
    128             Mat edgeDoesntMakeSense; 
    129             Mat justEdges; //TESTING 
    130  
    131379            String directory = "/Scratch/cpb16/is-sheet-music-encore/download-images/MU/"; 
    132380            //!!!!!!!!!!!!!!!!!!!!!!!!!!!NOT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
    133381            //mdp.39015097852365-2.png 176 lines    Contents page. 
    134382            //mdp.39015097852555-3.png 76  lines 
    135             String default_file = directory+"SheetMusic/mdp.39015080972303-3.png"; 
     383            String default_file = directory+"SheetMusic/coo.31924062612282-9.png"; 
    136384            //String default_file ="TestImages/NotNot/mdp.39015080972303-3.png"; 
    137385 
     
    152400            Mat original = Imgcodecs.imread(filename, Imgcodecs.IMREAD_GRAYSCALE); 
    153401            // Edge detection 
    154             //01 CANNY 
    155             //Imgproc.Canny(original, edgesDetected, 50, 200, 3, false); 
    156             //Imgproc.Canny(original, edgesDetected,0, 100, 3, false ); 
    157             //Imgproc.Canny(original, edgesDetected,80, 120); 
    158             //02 BINARYINV 
    159             Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV,15, 2); 
    160  
    161             //Imgproc.adaptiveThreshold(original, edgesExtra,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV,15, 2); 
    162             //Imgproc.medianBlur(edgesExtra, edgesDetected, 3); 
    163             //03 BINARY 
    164             //Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY,15, 2); 
    165             //04 NO PROC 
    166             //edgesDetected = original.clone(); 
    167             //05 OTSU THRESHOLD 
    168             //Imgproc.threshold(original, edgesDetected,0,255,Imgproc.THRESH_BINARY_INV+Imgproc.THRESH_OTSU); 
    169  
    170  
    171  
    172  
     402            Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 15, 4); 
    173403 
    174404            //Convert to RGB for future use 
    175405            Imgproc.cvtColor(edgesDetected, edgesDetectedRGB, Imgproc.COLOR_GRAY2BGR); 
    176             justEdges = edgesDetectedRGB.clone();//TESTING 
    177             edgesDetectedRGBProb = edgesDetectedRGB.clone(); 
    178             edgeDoesntMakeSense = edgesDetectedRGB.clone(); 
    179406 
    180407            Mat linesP = new Mat(); // will hold the results of the detection 
     
    184411 
    185412            Imgproc.HoughLinesP(edgesDetected, linesP, 1, Math.PI / 720, HOUGHLINEP_THRESHOLD, minLineLength,MAXLINEGAP); // runs the actual detection 
    186             //Imgproc.HoughLinesP(edgesDetected, linesP, 1, Math.PI / 180, HOUGHLINEP_THRESHOLD, minLineLength,MAXLINEGAP); // runs the actual detection 
    187             System.out.println("Before Graident Filtering num lines: " + linesP.rows()); 
    188  
    189             //Imgproc.HoughLinesP(edgesDetected,linesP,1,Math.PI/2, 50, 80, 5); 
     413            System.out.println("Before Gradient Filtering num lines: " + linesP.rows()); 
     414 
    190415            // Draw the lines 
    191416            for (int x = 0; x < linesP.rows(); x++) { 
    192417                double[] l = linesP.get(x, 0); 
    193  
    194                 //Find angle that line is at 
    195                 //double rho = linesP.get(x, 0)[0]; 
    196                 //double theta = linesP.get(x, 0)[1]; 
    197                 //double cosTheta = Math.cos(theta); 
    198                 //double sinTheta = Math.sin(theta); 
    199                 //double x0 = cosTheta * rho; 
    200                 //double y0 = sinTheta * rho; 
    201                 //double xpt1 = x0 + 1000 * (-sinTheta); 
    202                 //double ypt1 = y0 + 1000 * (cosTheta); 
    203                 //double xpt2 = x0 - 1000 * (-sinTheta); 
    204                 //double ypt2 = y0 - 1000 * (cosTheta); 
    205                 //double angle =  Math.atan2((float)ypt2 - (float)ypt1, (float)xpt2 - (float)xpt1)*(Math.PI); 
    206                 //double testAngle = (ypt2 - ypt1)/(xpt2 - xpt1); 
    207  
    208                 //New angles 
    209418                Point p1 = new Point(l[0], l[1]); 
    210419                Point p2 = new Point(l[2], l[3]); 
    211420                double m = Math.abs(p2.y - p1.y)/(p2.x - p1.x); 
    212                 //System.out.println(l[0]); 
    213                 //System.out.println(l[1]); 
    214                 //System.out.println(l[2]); 
    215                 //System.out.println(l[3]); 
    216  
    217421 
    218422                if(m<=SLOPEGRADIENT) { 
    219                     //System.out.println("m: " + m); 
    220                     Imgproc.line(edgesDetectedRGB, new Point(l[0], l[1]), new Point(l[2], l[3]), new Scalar(0, 0, 255), 1, Imgproc.LINE_AA, 0); 
     423                    Imgproc.line(edgesDetectedRGB, p1, p2, new Scalar(0, 0, 255), 1, Imgproc.LINE_4, 0); 
    221424                    horizontalLineCount++; 
     425                    pointArrayList.add(new StartAndEndPoint(p1, p2)); 
    222426                } 
    223427 
     
    226430            //Prove by finding number of points from one end to other: 
    227431            //Get width of image. 
    228             System.out.println("every matrix widths: "+edgesDetectedRGB.size().width); 
    229432            File filenameTest = new File("TestImages/NotSheetMusic02.png"); 
    230433            BufferedImage i = ImageIO.read(filenameTest); 
    231             System.out.println("input image width: "+ i.getWidth()); 
    232  
    233434            BufferedImage toBeClassifiedImg = toBufferedImage(edgesDetectedRGB); 
    234             System.out.println("Result: " + Classifier(horizontalLineCount)); 
    235  
    236  
    237             System.out.println(); 
     435 
     436            System.out.println("LINE COUNT RESULT:   " +  ClassifierLineCount(horizontalLineCount) + '\t' +"LineCount: " + horizontalLineCount); //COUNT OF LINES CLASSIFICATION 
     437            System.out.println("LINE CLUSTER RESULT: " +  ClassifierLineClusterOLD(toBeClassifiedImg).get(0) + '\t' + "LinesFound: " + ClassifierLineClusterOLD(toBeClassifiedImg).get(1) + '\t' + "ClustersFound: " + ClassifierLineClusterOLD(toBeClassifiedImg).get(2)); 
     438            //System.out.println("NEW CLUSTER RESULTS: " +  ClassifierLineCluster(pointArrayList).get(0) + '\t' + "LinesFound: " + ClassifierLineCluster(pointArrayList).get(1) + '\t' + "ClustersFound: " + ClassifierLineCluster(pointArrayList).get(2)); 
     439            System.out.println(ClassifierLineCluster(pointArrayList)); 
     440 
    238441            //Display Results 
    239             HighGui.imshow("Source", original); 
     442            //HighGui.imshow("Source", original); 
    240443            //HighGui.imshow("Just Edges", justEdges); //TESTING 
    241444            HighGui.imshow("Detected Lines (in red) - positive", edgesDetectedRGB); 
  • other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaAccuracyCalculator.java

    r33170 r33304  
    7070                 
    7171                //Correctly identified SheetMusic as SheetMusic 
    72                 trueAccuracyRate = ((float)truePositive/(float)sheetMusicCount)*(float)100; 
    73  
    74                 //Amount of Correctly identified NotSheetSheetMusic as NotSheetMusic 
    75                 falseAccuracyRate = ((float)trueNegative/(float)notSheetMusicCount)*(float)100; 
     72                if(sheetMusicCount != 0){ 
     73                    trueAccuracyRate = ((float)truePositive/(float)sheetMusicCount)*(float)100; 
     74                } 
     75                else { 
     76                    trueAccuracyRate = 0; 
     77                } 
    7678                 
    77                 overallAccuracyRate = (truePositive + trueNegative)/(float)(sheetMusicCount+notSheetMusicCount)*(float)100; 
     79                if(notSheetMusicCount != 0){ 
     80                    //Amount of Correctly identified NotSheetSheetMusic as NotSheetMusic 
     81                    falseAccuracyRate = ((float)trueNegative/(float)notSheetMusicCount)*(float)100; 
     82                } 
     83                else { 
     84                    falseAccuracyRate = 0; 
     85                } 
     86                 
     87                if(notSheetMusicCount != 0 && sheetMusicCount != 0) { 
     88                    overallAccuracyRate = (truePositive + trueNegative)/(float)(sheetMusicCount+notSheetMusicCount)*(float)100; 
     89                } 
     90                else if (sheetMusicCount = 0) { 
     91                    overallAccuracyRate = falseAccuracyRate/2; 
     92                } 
     93                else { 
     94                    overallAccuracyRate = trueAccuracyRate/2; 
     95                } 
    7896                 
    7997                fw.write("Date: " + d.toString() + '\n' 
  • other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaImageClassifier.java

    r33243 r33304  
    3333    static int CLASSIFIER_HOUGHLINESP_MAX   = 65; 
    3434    static int HOUGHLINEP_THRESHOLD         = 10; 
    35     static int MINLINECOUNT                 = 40; //50 
     35    static int MINLINECOUNT                 = 40; 
    3636    static double MAXLINEGAP                = 4; 
    37     static double SLOPEGRADIENT             = 0.02; //0.01 
     37    static double SLOPEGRADIENT             = 0.02; 
    3838 
    3939    public static void main(String[] args) {     
     
    136136        //Imgproc.Canny(original, edgesDetected, 50, 200, 3, false); 
    137137        Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV,15, 2); 
     138        //Imgproc.blur(edgesExtra, edgesDetected, new Size(3,1)); 
    138139        //Imgproc.medianBlur(edgesExtra, edgesDetected, 3); 
    139140         
     
    160161            if(m<SLOPEGRADIENT) { 
    161162                //System.out.println("m: " + m); 
    162                 Imgproc.line(edgesDetectedRGB, new Point(l[0], l[1]), new Point(l[2], l[3]), new Scalar(0, 0, 255), 1, Imgproc.LINE_AA, 0); 
     163                //Imgproc.line(edgesDetectedRGB, new Point(l[0], l[1]), new Point(l[2], l[3]), new Scalar(0, 0, 255), 1, Imgproc.LINE_AA, 0); SINCE NOT SAVING IMAGES OR COUNTING PIXELS 
    163164                horizontalLineCount++; 
    164165            } 
     
    166167         
    167168        //Convert MAT into a BufferedImage 
    168         BufferedImage toBeClassifiedImg = toBufferedImage(edgesDetectedRGB); 
     169        //BufferedImage toBeClassifiedImg = toBufferedImage(edgesDetectedRGB); SINCE NOT SAVING IMAGES OR COUNTING PIXELS 
    169170        //Calculate if its sheet music or not 
    170171        isSheetMusic = classifier_HoughLinesP_refined(horizontalLineCount);   
  • other-projects/is-sheet-music-encore/trunk/image-identification-terminal/results.txt

    r33243 r33304  
    1 Date: Thu Jun 20 18:40:41 NZST 2019 
    2 Classifier: houghlinesP 
    3 truePositive: 3098 
    4 falseNegative: 63 
    5 falsePositve: 624 
    6 trueNegative: 1216 
    7 SheetMusicAccuracyRate: 98.00696% 
    8 NotSheetMusicAccuracyRate: 66.08695% 
    9 OverallAccuracyRate: 86.26274% 
     1BEST RESULTS TO DATE 
    102 
    11 Date: Thu Jun 20 18:40:42 NZST 2019 
    12 Classifier: houghlinesP-refined 
    13 truePositive: 1666 
    14 falseNegative: 1495 
    15 falsePositve: 123 
    16 trueNegative: 1717 
    17 SheetMusicAccuracyRate: 52.70484% 
    18 NotSheetMusicAccuracyRate: 93.315216% 
    19 OverallAccuracyRate: 67.64648% 
    20  
    21  
    22  
    23  
    24 BEST SO FAR 
    25 Date: Tue Jun 25 16:02:11 NZST 2019 
    26 Classifier: houghlinesP-refined 
    27 truePositive: 80 
    28 falseNegative: 20 
    29 falsePositve: 11 
    30 trueNegative: 89 
    31 SheetMusicAccuracyRate: 80.0% 
    32 NotSheetMusicAccuracyRate: 89.0% 
    33 OverallAccuracyRate: 84.5% 
    34  
    35 Date: Tue Jun 25 16:21:55 NZST 2019 
    36 Classifier: houghlinesP 
    37 truePositive: 3063 
    38 falseNegative: 98 
    39 falsePositve: 596 
    40 trueNegative: 1244 
    41 SheetMusicAccuracyRate: 96.89972% 
    42 NotSheetMusicAccuracyRate: 67.608696% 
    43 OverallAccuracyRate: 86.12277% 
    44  
    45 Date: Tue Jun 25 20:06:21 NZST 2019 
    46 Classifier: houghlinesP-refined-all 
    47 truePositive: 1723 
    48 falseNegative: 1438 
    49 falsePositve: 86 
    50 trueNegative: 1754 
    51 SheetMusicAccuracyRate: 54.508064% 
    52 NotSheetMusicAccuracyRate: 95.32609% 
    53 OverallAccuracyRate: 69.52609% 
    54  
    55 Date: Tue Jun 25 20:13:22 NZST 2019 
    56 Classifier: houghlinesP-refined 
    57 truePositive: 80 
    58 falseNegative: 20 
    59 falsePositve: 11 
    60 trueNegative: 89 
    61 SheetMusicAccuracyRate: 80.0% 
    62 NotSheetMusicAccuracyRate: 89.0% 
    63 OverallAccuracyRate: 84.5% 
    64  
    65 Date: Tue Jun 25 22:40:22 NZST 2019 
    66 Classifier: houghlinesP-refined-all-canny 
    67 truePositive: 1124 
    68 falseNegative: 2037 
    69 falsePositve: 61 
    70 trueNegative: 1779 
    71 SheetMusicAccuracyRate: 35.558365% 
    72 NotSheetMusicAccuracyRate: 96.684784% 
    73 OverallAccuracyRate: 58.048393% 
    74  
    75 MAX 65 
    76 MIN 10 
    77 ALL MU 
    78 RESULT: 
    79  
    80  
    81 Date: Wed Jun 26 20:08:09 NZST 2019 
    82 Classifier: houghlinesP-refined-all-canny 
    83 truePositive: 1124 
    84 falseNegative: 2037 
    85 falsePositve: 61 
    86 trueNegative: 1779 
    87 SheetMusicAccuracyRate: 35.558365% 
    88 NotSheetMusicAccuracyRate: 96.684784% 
    89 OverallAccuracyRate: 58.048393% 
    90  
    91 Date: Wed Jun 26 20:44:04 NZST 2019 
    92 Classifier: houghlinesP-refined-all 
    93 truePositive: 1725 
    94 falseNegative: 1436 
    95 falsePositve: 87 
    96 trueNegative: 1753 
    97 SheetMusicAccuracyRate: 54.571335% 
    98 NotSheetMusicAccuracyRate: 95.271736% 
    99 OverallAccuracyRate: 69.54609% 
    100  
    101 BOTH PRE THURSDAY MEETING 
    102 Date: Wed Jun 26 21:40:37 NZST 2019 
     3Date: Tue Jul 02 12:35:16 NZST 2019 
    1034Classifier: houghlinesP 
    1045truePositive: 3103 
     
    11011OverallAccuracyRate: 85.642876% 
    11112 
    112 Date: Wed Jun 26 21:40:37 NZST 2019 
     13Date: Tue Jul 02 12:35:16 NZST 2019 
    11314Classifier: houghlinesP-refined 
    114 truePositive: 1725 
    115 falseNegative: 1436 
    116 falsePositve: 87 
    117 trueNegative: 1753 
    118 SheetMusicAccuracyRate: 54.571335% 
    119 NotSheetMusicAccuracyRate: 95.271736% 
    120 OverallAccuracyRate: 69.54609% 
    121  
    122  
    123 POST MEETING  
    124  
    125  
    126 Date: Thu Jun 27 11:56:02 NZST 2019 
    127 Classifier: houghlinesP-refined 
    128 truePositive: 0 
    129 falseNegative: 0 
    130 falsePositve: 0 
    131 trueNegative: 0 
    132 SheetMusicAccuracyRate: 0.0% 
    133 NotSheetMusicAccuracyRate: 0.0% 
    134 OverallAccuracyRate: 0.0% 
    135  
    136 Date: Thu Jun 27 12:04:40 NZST 2019 
    137 Classifier: houghlinesP-refined-test 
    138 truePositive: 7 
    139 falseNegative: 3 
    140 falsePositve: 5 
    141 trueNegative: 5 
    142 SheetMusicAccuracyRate: 70.0% 
    143 NotSheetMusicAccuracyRate: 50.0% 
    144 OverallAccuracyRate: 60.000004% 
    145  
    146 LINE GAP OF 10 
    147  
    148 Date: Thu Jun 27 12:24:59 NZST 2019 
    149 Classifier: houghlinesP-refined-all 
    150 truePositive: 2808 
    151 falseNegative: 353 
    152 falsePositve: 307 
    153 trueNegative: 1533 
    154 SheetMusicAccuracyRate: 88.83265% 
    155 NotSheetMusicAccuracyRate: 83.315216% 
    156 OverallAccuracyRate: 86.802635% 
    157  
    158  
    159 LINE GAP OF 4 
    160  
    161  
    162 Date: Thu Jun 27 14:35:24 NZST 2019 
    163 Classifier: houghlinesP-refined-all 
    164 truePositive: 2626 
    165 falseNegative: 535 
    166 falsePositve: 77 
    167 trueNegative: 1763 
    168 SheetMusicAccuracyRate: 83.074974% 
    169 NotSheetMusicAccuracyRate: 95.815216% 
    170 OverallAccuracyRate: 87.76244% 
    171  
    172 MINLINECOUNT=40 
    173 gradient = 0.02 
    174 Date: Thu Jun 27 15:10:14 NZST 2019 
    175 Classifier: houghlinesP-refined-all 
    17615truePositive: 2961 
    17716falseNegative: 200 
     
    18221OverallAccuracyRate: 93.28135% 
    18322 
     23REFINEMENT IMPROVEMENT TESTS 
     24BINARY_INV, 15, 4 
     25 
     26Date: Tue Jul 02 12:56:53 NZST 2019 
     27Classifier: houghlinesP-refined-all 
     28truePositive: 2952 
     29falseNegative: 209 
     30falsePositve: 128 
     31trueNegative: 1712 
     32SheetMusicAccuracyRate: 93.38817% 
     33NotSheetMusicAccuracyRate: 93.04348% 
     34OverallAccuracyRate: 93.26135% 
     35 
     36BINARY_INV, 15, 4 
     37BLUR 3,1 
     38  
     39Date: Tue Jul 02 13:27:00 NZST 2019 
     40Classifier: houghlinesP-refined-all 
     41truePositive: 2989 
     42falseNegative: 172 
     43falsePositve: 211 
     44trueNegative: 1628 
     45SheetMusicAccuracyRate: 94.558685% 
     46NotSheetMusicAccuracyRate: 88.526375% 
     47OverallAccuracyRate: 92.34% 
     48