Changeset 33340 for other-projects/is-sheet-music-encore/trunk/image-identification-development/src/Main.java
- Timestamp:
- 2019-07-22T16:46:33+12:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/is-sheet-music-encore/trunk/image-identification-development/src/Main.java
r33326 r33340 144 144 return "Start: " + _p1 + " End: " + _p2; 145 145 } 146 /* 147 //CompareToOverride 148 //Compares start point y co ordinates of input PointArray 149 //With this. start point y co ordinate 150 @Override 151 public double compareTo(StartAndEndPoint comparePointArray){ 152 Point comparePoint = (comparePointArray.getP1()); 153 return (this.getP1().y) - (comparePoint.y); 154 } 155 */ 156 } 146 147 } 148 157 149 public static <T> ArrayList<T> removeDuplicates(ArrayList<T> list) { 158 150 //DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED//DIRECTLY COPIED … … 211 203 } 212 204 public static Boolean lineComparison(double baseLineS, double compareLineS, double compareLineE ){ 205 //System.out.print("Comparing baseLineS: " + baseLineS + " with compareLineE: " + compareLineE + " and compareLineS: " + compareLineS); 213 206 if(baseLineS < compareLineE && baseLineS > compareLineS){ 214 207 return true; … … 231 224 Boolean consistent = false; 232 225 if (variance <= CLUSTER_DISTANCE_MAX && variance > CLUSTER_DISTANCE_MIN) { 226 233 227 for (int i = 0; i < parseArray.length - 1; i++) { 234 228 //System.out.println(i); … … 658 652 //If it SD is less than 5 then it is considered to be a cluster of lines. 659 653 if(ClusterCheck(tempPtArray)){ 660 //System.out.println("tempArray PT: "+tempArray[0] + " , " + tempArray[1] + " , " + tempArray[2] + " , " + tempArray[3]); 661 //System.out.println("tempArray SD: " + StandardDeviation(tempArray)); 654 //System.out.println("tempArray PT: "+tempPtArray[0] + " , " + tempPtArray[1] + " , " + tempPtArray[2] + " , " + tempPtArray[3]); 662 655 //Store array 663 656 clusterPtArray.add(tempPtArray); … … 671 664 //break 672 665 Thread.sleep(2000); 673 System.out.println("End of closeLinePts -> break , i = " + i+ " closeLineYpos size= " + closeLinePts.size());666 //System.out.println("End of closeLinePts -> break , i = " + i+ " closeLineYpos size= " + closeLinePts.size()); 674 667 break; 675 668 } … … 678 671 } 679 672 } 680 /* 681 System.out.println("Cluster Coordinates: ");682 for( double[] items : clusterArray){683 for(int i = 0; i < items.length; i++){684 System.out.println("ITEMS: "+ items [i]);685 } 686 } 687 */ 673 674 /*System.out.println("Cluster Coordinates: "); 675 for(StartAndEndPoint[] items : clusterPtArray){ 676 for(int i = 0; i <clusterPtArray.size(); i++){ 677 System.out.println("ITEMS: "+ items); 678 } 679 }*/ 680 688 681 //Setup Drawing clusters found. 689 682 //For every pt given the input array … … 723 716 } 724 717 718 //SUPER CLASSIFIER FUNCTIONS 719 private static boolean LineCountOrCluster(int lineCount, ArrayList<StartAndEndPoint> linePointsArray, Mat clustersFoundRGB){ 720 ArrayList lineClusterResult = ClassifierLineClusterPt(linePointsArray, clustersFoundRGB); 721 722 723 //String test = ClassifierLineClusterPt(linePointsArray, clustersFoundRGB).get(0).toString(); 724 if(ClassifierLineCount(lineCount) == true){ 725 System.out.println("LineCount classifier Successful: " + '\t' +"LinesFound: " + lineCount); 726 return true; 727 } 728 else if(lineClusterResult.get(0).toString() == "true"){ 729 System.out.println("LineCluster classifier Successful: " + '\t' + "LinesFound: " + lineCount + '\t' + "ClustersFound: " + lineClusterResult.get(1)); 730 731 return false; 732 } 733 return false; 734 } 735 725 736 //MAIN 726 737 public static void main(String[] args) { … … 735 746 Mat edgesDetectedRGB = new Mat(); 736 747 Mat clustersFoundRGB = new Mat(); 737 String directory = "/Scratch/cpb16/is-sheet-music-encore/ download-images/MU/";748 String directory = "/Scratch/cpb16/is-sheet-music-encore/lowres-download-images/MU/"; 738 749 //!!!!!!!!!!!!!!!!!!!!!!!!!!!NOT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 739 750 //mdp.39015097852365-2.png 176 lines Contents page. 740 751 //mdp.39015097852555-3.png 76 lines 741 //String default_file = directory+"SheetMusic/coo.31924062612282-9.png"; 742 //String default_file ="TestImages/NotNot/mdp.39015080972303-3.png"; 752 //!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTNOT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 753 //coo.31924062612282-9.png 8 lines 754 //String default_file = directory+"NotSheetMusic/coo.31924062612282-9.png"; 755 //String default_file = directory+"NotSheetMusic/mdp.39015097852365-2.png"; 756 String default_file ="TestImages/NotNot/mdp.39015080972303-3.png"; 743 757 744 758 745 759 //System.out.println(default_file); 746 String default_file = "TestImages/NotSheetMusic01.png";760 //String default_file = "TestImages/NotSheetMusic01.png"; 747 761 //String default_file = "TestImages/NotSheetMusic02.png"; 748 762 //String default_file = "TestImages/SheetMusic01.png"; … … 805 819 806 820 807 System.out.println("LINE COUNT RESULT: " + ClassifierLineCount(horizontalLineCount) + '\t' +"LinesFound: " + horizontalLineCount); //COUNT OF LINES CLASSIFICATION821 //System.out.println("LINE COUNT RESULT: " + ClassifierLineCount(horizontalLineCount) + '\t' +"LinesFound: " + horizontalLineCount); //COUNT OF LINES CLASSIFICATION 808 822 //System.out.println("LINE CLUSTER RESULT: " + ClassifierLineClusterOLD(toBeClassifiedImg).get(0) + '\t' + "LinesFound: " + ClassifierLineClusterOLD(toBeClassifiedImg).get(1) + '\t' + "ClustersFound: " + ClassifierLineClusterOLD(toBeClassifiedImg).get(2)); 809 System.out.println("NEW CLUSTER RESULTS: " + ClassifierLineClusterPt(pointArrayList,clustersFoundRGB).get(0) + '\t' + "LinesFound: " + horizontalLineCount + '\t' + "ClustersFound: " + ClassifierLineClusterPt(pointArrayList,clustersFoundRGB).get(1));823 //System.out.println("NEW CLUSTER RESULTS: " + ClassifierLineClusterPt(pointArrayList,clustersFoundRGB).get(0) + '\t' + "LinesFound: " + horizontalLineCount + '\t' + "ClustersFound: " + ClassifierLineClusterPt(pointArrayList,clustersFoundRGB).get(1)); 810 824 //System.out.println(ClassifierLineClusterPt(pointArrayList, clustersFoundRGB)); 825 826 System.out.println("TEST: " + LineCountOrCluster(horizontalLineCount, pointArrayList, clustersFoundRGB)); 811 827 812 828 // Wait and Exit
Note:
See TracChangeset
for help on using the changeset viewer.