/src/Period.java

https://bitbucket.org/yan_chen/pc-image-processing · Java · 129 lines · 86 code · 26 blank · 17 comment · 19 complexity · 5d88164ad7eddb9b81f48b512e3594c9 MD5 · raw file

  1. import static com.googlecode.javacv.cpp.opencv_core.*;
  2. import static com.googlecode.javacv.cpp.opencv_imgproc.*;
  3. import static com.googlecode.javacv.cpp.opencv_highgui.*;
  4. import java.io.File;
  5. import java.util.Scanner;
  6. public class Period{
  7. public static void main (String[] args)throws Exception,NullPointerException
  8. {
  9. int location[][] = new int[16][4];
  10. long click[][] = new long[1000][2];
  11. File key = new File(("C:/Users/chens_000/Desktop/3.txt"));
  12. long timestample[] = new long[1000];
  13. Scanner keys = new Scanner(key);
  14. keys.useDelimiter("\\s+|,|\\n|:|;|\\(|\\)| ");
  15. String b[] = new String[200000];
  16. int ii = 0;
  17. String c = null;
  18. int jj = 0;
  19. b[0] = null;
  20. while (keys.hasNext())
  21. {
  22. b[ii] = keys.next();
  23. if((b[ii].equals("Period")) && (b[ii-1].equals("Relea")))
  24. {
  25. timestample[jj] = Long.parseLong(keys.next());
  26. System.out.println(timestample[jj]+" ");
  27. jj++;
  28. }
  29. ii++;
  30. }
  31. int k = 0;
  32. int l=0;
  33. int m;
  34. int nn=0;
  35. int mm=8;
  36. long cc[] = new long[16];
  37. int dian = 0;
  38. /*
  39. long xy[][][]= new long[16][10000][2];
  40. IplImage src = cvLoadImage("C:/Users/chens_000/Desktop/new2/click.jpg",0);
  41. // IplImage gray = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);
  42. int radius = 1;
  43. l=0;
  44. int lo=0;
  45. for(lo=0;lo<dian;lo++)
  46. {
  47. CvPoint center = cvPointFrom32f(new CvPoint2D32f(click[lo][0],click[lo][1]));
  48. cvCircle(src, center, radius, CvScalar.GREEN, 6, CV_AA, 0);
  49. }
  50. cvSaveImage("C:/Users/chens_000/Desktop/new2/click1.jpg", src);
  51. cvShowImage("Result",src);
  52. cvWaitKey(0);
  53. */
  54. }
  55. public static int taskorder(String i){
  56. int j = 0;
  57. if(i.equals("task1.jpg"))
  58. j=0;
  59. if(i.equals("task2.jpg"))
  60. j=1;
  61. if(i.equals("task3.jpg"))
  62. j=2;
  63. if(i.equals("task3a.jpg"))
  64. j=3;
  65. if(i.equals("task3b.jpg"))
  66. j=4;
  67. if(i.equals("task3c.jpg"))
  68. j=5;
  69. if(i.equals("task3d.jpg"))
  70. j=6;
  71. if(i.equals("task4.jpg"))
  72. j=7;
  73. if(i.equals("task5.jpg"))
  74. j=8;
  75. if(i.equals("task6.jpg"))
  76. j=9;
  77. if(i.equals("task7.jpg"))
  78. j=10;
  79. if(i.equals("task8.jpg"))
  80. j=11;
  81. if(i.equals("task9.jpg"))
  82. j=12;
  83. if(i.equals("task10.jpg"))
  84. j=13;
  85. if(i.equals("task11.jpg"))
  86. j=14;
  87. if(i.equals("task12.jpg"))
  88. j=15;
  89. return j;
  90. }
  91. public static boolean isParsableToInt(String i) {
  92. try
  93. {
  94. Long.parseLong(i);
  95. return true;
  96. }
  97. catch (NumberFormatException nfe)
  98. {
  99. return false;
  100. }
  101. }
  102. }