Ignore:
Timestamp:
2019-08-28T17:03:18+12:00 (5 years 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.