@@ -25,46 +25,42 @@ public class PlateHorizontalGraph extends Graph {
25
25
private static int horizontalDetectionType =
26
26
Configurator .getConfigurator ().getIntProperty ("platehorizontalgraph_detectionType" );
27
27
28
- private Plate handle ;
29
-
30
- public PlateHorizontalGraph (Plate handle ) {
31
- this .handle = handle ;
32
- }
33
-
34
28
public float derivation (int index1 , int index2 ) {
35
29
return this .yValues .elementAt (index1 ) - this .yValues .elementAt (index2 );
36
30
}
37
31
38
- public Vector <Peak > findPeak (int count ) {
32
+ public Vector <Peak > findPeak () {
39
33
if (PlateHorizontalGraph .horizontalDetectionType == 1 ) {
40
- return this .findPeak_edgedetection (count );
34
+ return this .findPeak_edgedetection ();
41
35
}
42
- return this .findPeak_derivative (count );
36
+ return this .findPeak_derivative ();
43
37
}
44
38
45
- public Vector <Peak > findPeak_derivative (int count ) {
46
- int a , b ;
39
+ public Vector <Peak > findPeak_derivative () {
40
+ int a = 2 ;
41
+ int b = this .yValues .size () - 1 - 2 ;
47
42
float maxVal = this .getMaxValue ();
48
- for ( a = 2 ; (-this .derivation (a , a + 4 ) < (maxVal * 0.2 )) && (a < (this .yValues .size () - 2 - 2 - 4 )); a ++ ) {
49
- // intentionally empty
43
+ while ( (-this .derivation (a , a + 4 ) < (maxVal * 0.2 )) && (a < (this .yValues .size () - 2 - 2 - 4 ))) {
44
+ a ++;
50
45
}
51
- for ( b = this . yValues . size () - 1 - 2 ; ( this .derivation (b - 4 , b ) < (maxVal * 0.2 )) && (b > (a + 2 )); b -- ) {
52
- // intentionally empty
46
+ while (( this .derivation (b - 4 , b ) < (maxVal * 0.2 )) && (b > (a + 2 ))) {
47
+ b --;
53
48
}
54
49
Vector <Peak > outPeaks = new Vector <Peak >();
55
50
outPeaks .add (new Peak (a , b ));
56
51
super .peaks = outPeaks ;
57
52
return outPeaks ;
58
53
}
59
54
60
- public Vector <Peak > findPeak_edgedetection (int count ) {
55
+ public Vector <Peak > findPeak_edgedetection () {
61
56
float average = this .getAverageValue ();
62
- int a , b ;
63
- for (a = 0 ; this .yValues .elementAt (a ) < average ; a ++) {
64
- // intentionally empty
57
+ int a = 0 ;
58
+ int b = this .yValues .size () - 1 ;
59
+ while (this .yValues .elementAt (a ) < average ) {
60
+ a ++;
65
61
}
66
- for ( b = this .yValues .size () - 1 ; this . yValues . elementAt (b ) < average ; b -- ) {
67
- // intentionally empty
62
+ while ( this .yValues .elementAt (b ) < average ) {
63
+ b --;
68
64
}
69
65
Vector <Peak > outPeaks = new Vector <Peak >();
70
66
a = Math .max (a - 5 , 0 );
0 commit comments