Changeset 33589 for other-projects/is-sheet-music-encore/trunk/image-identification-dev-02/image-identification-development/src/Main.java
- Timestamp:
- 2019-10-21T21:45:10+13:00 (4 years ago)
- 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 111 111 static int STANDARD_DEVIATION_THRESHOLD = 6; 112 112 static int MINLINECOUNT = 40; 113 static int MAXLINEGAP = 1; //4113 static int MAXLINEGAP = 1; 114 114 static double THRESHOLD_C = 4; 115 115 static double SLOPEGRADIENT = 0.02; //0.02 … … 757 757 //!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTNOT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 758 758 //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"; 760 761 761 762 //String default_file = hiresDirectory+ "MU/SheetMusic/mdp.39015096402204-2.png"; … … 778 779 //String default_file = "TestImages/SheetMusic01.png"; 779 780 //String default_file = "TestImages/SheetMusic02.png"; 780 String default_file = "TestImages/vLine.png";781 //String default_file = "TestImages/vLine.png"; 781 782 String filename = ((args.length > 0) ? args[0] : default_file); 782 783 File file = new File(filename); … … 791 792 // Edge detection 792 793 793 Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 1 5, THRESHOLD_C);794 Imgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 1001, THRESHOLD_C); 794 795 //TEST PARAMETERSImgproc.adaptiveThreshold(original, edgesDetected,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 531,1); 795 796 796 797 797 798 // //IGNORE BORDERS OF IMAGE (using crop) 798 // Imgproc.adaptiveThreshold(original, mid,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 1 5, 2);799 // Imgproc.adaptiveThreshold(original, mid,255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY_INV, 1001, 2); 799 800 // double maxX = mid.size().width; 800 801 // double maxY = mid.size().height; 801 // Point cp1 = new Point(maxX/ 10, maxY/10);802 // Point cp1 = new Point(maxX/5, maxY/5); 802 803 // Point cp2 = new Point(maxX - cp1.x, maxY -cp1.y); 803 804 // Rect rectCrop = new Rect(cp1, cp2); 804 805 // edgesDetected = mid.submat(rectCrop); 805 806 806 807 // System.out.println("Width: " + edgesDetected.width() + " Height: " + edgesDetected.height()); 807 808 //****************MORPHOLOGY**************************************************************************************** 808 809 //ADDIOTIONAL FILTERING TO STOP STREAKS … … 833 834 834 835 double minLineLength = edgesDetectedRGB.size().width/8; 835 836 imwrite("houghtest-bin.jpg", edgesDetectedRGB); 836 837 Imgproc.HoughLinesP(edgesDetected, linesP, 1, Math.PI / 720, HOUGHLINEP_THRESHOLD, minLineLength,MAXLINEGAP); // runs the actual detection 837 838 //System.out.println("Before Gradient Filtering num lines: " + linesP.rows()); … … 856 857 //File filenameTest = new File("TestImages/NotSheetMusic02.png"); 857 858 //BufferedImage i = ImageIO.read(filenameTest); 858 BufferedImage toBeClassifiedImg = toBufferedImage(edgesDetectedRGB);859 //BufferedImage toBeClassifiedImg = toBufferedImage(edgesDetectedRGB); 859 860 860 861 861 862 //Display Results 863 864 imwrite("houghtest-lines.jpg", edgesDetectedRGB); 862 865 //HighGui.imshow("Source", original); 863 866 //HighGui.imshow("Just Edges", justEdges); //TESTING 864 867 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); 871 876 872 877 //HighGui.imshow("Detected Lines (in red) - negative", edgesDetectedRGBProb); … … 874 879 System.out.println("LINE COUNT RESULT: " + ClassifierLineCount(horizontalLineCount) + '\t' +"LinesFound: " + horizontalLineCount); //COUNT OF LINES CLASSIFICATION 875 880 //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)); 877 882 //System.out.println(ClassifierLineClusterPt(pointArrayList, clustersFoundRGB)); 878 883 … … 880 885 881 886 // Wait and Exit 882 HighGui.waitKey();887 //HighGui.waitKey(); 883 888 System.exit(0); 884 889 }
Note:
See TracChangeset
for help on using the changeset viewer.