- Timestamp:
- 2019-05-16T11:15:02+12:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/is-sheet-music-encore/trunk/image-identification/src/Main.java
r33070 r33082 16 16 //https://riptutorial.com/opencv/example/21963/converting-an-mat-object-to-an-bufferedimage-object 17 17 18 19 20 //GOAL for 21st 21 22 23 //Classifier 01 24 //Have args so can call "java image-identification-classifier01 XX XX" 25 //args can be parameters in algorthim such as threshold or theta? 26 //Run on 5000 images. 27 //Record success rates 28 //All done with makefile 29 30 31 //But first understand houghline transform 32 //Know what the algorithm being used is doing. 33 //MAke constants for this classifier 34 //Make java be able to run on CMD line 18 35 19 36 public class Main { … … 65 82 percentage = ((float)redCount/(float)pixelCount)*(float)100; 66 83 //If more than %10 and less than %50 then its sheet music! 67 if(percentage > 10 && percentage < 50){ 84 if(percentage > 10 && percentage < 50){ //MAKE THESE CONSTANTS!! 68 85 return true;} 69 86 } … … 99 116 Imgproc.HoughLines(edgesDetected, lines, 1, Math.PI / 180, 150); // runs the actual detection 100 117 // Draw the lines 118 //LOOK OVER THIS AGAIN THE 1000 might be image height? 119 //THRESHOLD should be changed, based on img dimensions? 120 101 121 for (int x = 0; x < lines.rows(); x++) { 102 122 double rho = lines.get(x, 0)[0], 103 123 theta = lines.get(x, 0)[1]; 124 //CONVERT to Cartisean coord 104 125 double a = Math.cos(theta), b = Math.sin(theta); 105 126 double x0 = a * rho, y0 = b * rho; 127 106 128 Point pt1 = new Point(Math.round(x0 + 1000 * (-b)), Math.round(y0 + 1000 * (a))); 107 129 Point pt2 = new Point(Math.round(x0 - 1000 * (-b)), Math.round(y0 - 1000 * (a)));
Note:
See TracChangeset
for help on using the changeset viewer.