Ignore:
Timestamp:
2019-10-21T21:45:10+13:00 (4 years ago)
Author:
cpb16
Message:

final01. Need Map results still

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/is-sheet-music-encore/trunk/image-identification-dev-02/image-identification-development/src/Main.java

    r33455 r33589  
    111111    static int STANDARD_DEVIATION_THRESHOLD = 6;
    112112    static int MINLINECOUNT                 = 40;
    113     static int MAXLINEGAP                   = 1;  //4
     113    static int MAXLINEGAP                   = 1;
    114114    static double THRESHOLD_C               = 4;
    115115    static double SLOPEGRADIENT             = 0.02; //0.02
     
    757757            //!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTNOT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    758758            //coo.31924062612282-9.png 8   lines
    759             //String default_file = hiresDirectory+ "MU/SheetMusic/mdp.39015096400919-9.png";
     759            String default_file = hiresDirectory+ "MU/SheetMusic/mdp.39015096400919-9.png";
     760            //String default_file = hiresDirectory+ "MU/SheetMusic/coo.31924062612282-9.png";
    760761
    761762            //String default_file = hiresDirectory+ "MU/SheetMusic/mdp.39015096402204-2.png";
     
    778779            //String default_file = "TestImages/SheetMusic01.png";
    779780            //String default_file = "TestImages/SheetMusic02.png";
    780             String default_file = "TestImages/vLine.png";
     781            //String default_file = "TestImages/vLine.png";
    781782            String filename = ((args.length > 0) ? args[0] : default_file);
    782783            File file = new File(filename);
     
    791792            // Edge detection
    792793
    793             Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 15, THRESHOLD_C);
     794            Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 1001, THRESHOLD_C);
    794795            //TEST PARAMETERSImgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 531,1);
    795796
    796797
    797798//            //IGNORE BORDERS OF IMAGE (using crop)
    798 //            Imgproc.adaptiveThreshold(original, mid,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 15, 2);
     799//            Imgproc.adaptiveThreshold(original, mid,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 1001, 2);
    799800//            double maxX = mid.size().width;
    800801//            double maxY = mid.size().height;
    801 //            Point cp1 = new Point(maxX/10, maxY/10);
     802//            Point cp1 = new Point(maxX/5, maxY/5);
    802803//            Point cp2 = new Point(maxX - cp1.x, maxY -cp1.y);
    803804//            Rect rectCrop = new Rect(cp1, cp2);
    804805//            edgesDetected = mid.submat(rectCrop);
    805806
    806 
     807//            System.out.println("Width: " + edgesDetected.width() + " Height: " + edgesDetected.height());
    807808            //****************MORPHOLOGY****************************************************************************************
    808809            //ADDIOTIONAL FILTERING TO STOP STREAKS
     
    833834
    834835            double minLineLength = edgesDetectedRGB.size().width/8;
    835 
     836            imwrite("houghtest-bin.jpg", edgesDetectedRGB);
    836837            Imgproc.HoughLinesP(edgesDetected, linesP, 1, Math.PI / 720, HOUGHLINEP_THRESHOLD, minLineLength,MAXLINEGAP); // runs the actual detection
    837838            //System.out.println("Before Gradient Filtering num lines: " + linesP.rows());
     
    856857            //File filenameTest = new File("TestImages/NotSheetMusic02.png");
    857858            //BufferedImage i = ImageIO.read(filenameTest);
    858             BufferedImage toBeClassifiedImg = toBufferedImage(edgesDetectedRGB);
     859            //BufferedImage toBeClassifiedImg = toBufferedImage(edgesDetectedRGB);
    859860
    860861
    861862            //Display Results
     863
     864            imwrite("houghtest-lines.jpg", edgesDetectedRGB);
    862865            //HighGui.imshow("Source", original);
    863866            //HighGui.imshow("Just Edges", justEdges); //TESTING
    864867
    865 
    866             HighGui.imshow("LINESFOUND", edgesDetectedRGB);
    867             HighGui.resizeWindow("LINESFOUND", 1000,1000);
    868            
    869             HighGui.imshow("CLUSTERSFOUND", clustersFoundRGB);
    870             HighGui.resizeWindow("CLUSTERSFOUND", 1000,1000);
     868//            HighGui.namedWindow("LINESFOUND", HighGui.WINDOW_AUTOSIZE);
     869//            HighGui.imshow("LINESFOUND", edgesDetectedRGB);
     870//            HighGui.resizeWindow("LINESFOUND", 1000,1000);
     871//
     872//
     873//            HighGui.imshow("CLUSTERSFOUND", clustersFoundRGB);
     874//            HighGui.namedWindow("CLUSTERSFOUND", HighGui.WINDOW_AUTOSIZE);
     875//            HighGui.resizeWindow("CLUSTERSFOUND", 1000,1000);
    871876
    872877            //HighGui.imshow("Detected Lines (in red) - negative", edgesDetectedRGBProb);
     
    874879            System.out.println("LINE COUNT RESULT:   " +  ClassifierLineCount(horizontalLineCount) + '\t' +"LinesFound: " + horizontalLineCount); //COUNT OF LINES CLASSIFICATION
    875880            //System.out.println("LINE CLUSTER RESULT: " +  ClassifierLineClusterOLD(toBeClassifiedImg).get(0) + '\t' + "LinesFound: " + ClassifierLineClusterOLD(toBeClassifiedImg).get(1) + '\t' + "ClustersFound: " + ClassifierLineClusterOLD(toBeClassifiedImg).get(2));
    876             System.out.println("NEW CLUSTER RESULTS: " +  ClassifierLineClusterPt(pointArrayList,clustersFoundRGB).get(0) + '\t' + "LinesFound: " + horizontalLineCount + '\t' + "ClustersFound: " + ClassifierLineClusterPt(pointArrayList,clustersFoundRGB).get(1));
     881            //System.out.println("NEW CLUSTER RESULTS: " +  ClassifierLineClusterPt(pointArrayList,clustersFoundRGB).get(0) + '\t' + "LinesFound: " + horizontalLineCount + '\t' + "ClustersFound: " + ClassifierLineClusterPt(pointArrayList,clustersFoundRGB).get(1));
    877882            //System.out.println(ClassifierLineClusterPt(pointArrayList, clustersFoundRGB));
    878883
     
    880885
    881886            // Wait and Exit
    882             HighGui.waitKey();
     887            //HighGui.waitKey();
    883888            System.exit(0);
    884889        }
Note: See TracChangeset for help on using the changeset viewer.