-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFuzzifyZoom.java
More file actions
119 lines (86 loc) · 4.19 KB
/
FuzzifyZoom.java
File metadata and controls
119 lines (86 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*============================================================================
* Title : Auto-Zoom Function Of A Digital Camera Using Fuzzy Logic
* Description : An auto-zoom function for a digital camera that uses Fuzzy
* Logic to decide on the level of zoom the camera must use in a
* certain distance between the camera and the object to be
* photographed.
* Filename : FuzzifyZoom.java
* Version : v1.0
* Author : Group 1
* Yr&Sec : 3-3
* Subject : Computational Intelligence
*============================================================================*/
public class FuzzifyZoom {
/*============================================================================*
* Function : FuzzifyZoom
* Params : None
* Returns : arrZoom -> Array of the DOMs off all the points in the output.
* Description: Returns list of aggregated values for each membership functions.
*============================================================================*/
public double[][] FuzzifyZoom() {
//======================== Initialization ========================//
double[][] arrZoom = new double[5][201];
int intValCtr;
//================================================================//
//========================== Code Body ===========================//
/* Zoom: Maximum Zoom Out */
for(intValCtr = 0; intValCtr < 21; intValCtr++)
arrZoom[0][intValCtr] = 1;
// Right-side slope of Zoom: Maximum Zoom Out
double dblMaxZOutR = -8;
for(intValCtr = 21; intValCtr < 61; intValCtr++, dblMaxZOutR += .1)
arrZoom[0][intValCtr] = -0.25 * (Math.round(dblMaxZOutR * 100.0) / 100.0) - 1;
for(intValCtr = 61; intValCtr < 201; intValCtr++)
arrZoom[0][intValCtr] = 0;
/* Zoom: Minimum Zoom Out */
for(intValCtr = 0; intValCtr < 41; intValCtr++)
arrZoom[1][intValCtr] = 0;
// Left-side slope of Zoom: Minimum Zoom Out
double dblMinZOutL = -6;
for(intValCtr = 41; intValCtr < 81; intValCtr++, dblMinZOutL += .1)
arrZoom[1][intValCtr] = .25 * (Math.round(dblMinZOutL * 100.0) / 100.0) + 1.5;
// Right-side slope of Zoom: Minimum Zoom Out
double dblMinZOutR = -2;
for(intValCtr = 81; intValCtr < 101; intValCtr++, dblMinZOutR += .1)
arrZoom[1][intValCtr] = -0.5 * (Math.round(dblMinZOutR * 100.0) / 100.0);
for(intValCtr = 101; intValCtr < 201; intValCtr++)
arrZoom[1][intValCtr] = 0;
/* Zoom: Default Zoom */
for(intValCtr = 0; intValCtr < 81; intValCtr++)
arrZoom[2][intValCtr] = 0;
// Left-side slope of Zoom: Default
double dblDefL = -2;
for(intValCtr = 81; intValCtr < 101; intValCtr++, dblDefL += .1)
arrZoom[2][intValCtr] = .5 * (Math.round(dblDefL * 100.0) / 100.0) + 1;
// Right-side slope of Zoom: Default
double dblDefR = 0;
for(intValCtr = 101; intValCtr < 121; intValCtr++, dblDefR += .1) // -.5, 1
arrZoom[2][intValCtr] = -.5 * (Math.round(dblDefR * 100.0) / 100.0) + 1;
for(intValCtr = 121; intValCtr < 201; intValCtr++)
arrZoom[2][intValCtr] = 0;
/* Zoom: Minimum Zoom In */
for(intValCtr = 0; intValCtr < 101; intValCtr++)
arrZoom[3][intValCtr] = 0;
// Left-side slope of Zoom: Minimum Zoom In
double dblMinZInL = 0;
for(intValCtr = 101; intValCtr < 121; intValCtr++, dblMinZInL += .1)
arrZoom[3][intValCtr] = .5 * (Math.round(dblMinZInL * 100.0) / 100.0);
// Right-side slope of Zoom: Minimum Zoom In
double dblMinZInR = 2;
for(intValCtr = 121; intValCtr < 161; intValCtr++, dblMinZInR += .1)
arrZoom[3][intValCtr] = -0.25 * (Math.round(dblMinZInR * 100.0) / 100.0) + 1.5;
for(intValCtr = 161; intValCtr < 201; intValCtr++)
arrZoom[3][intValCtr] = 0;
/* Zoom: Maximum Zoom In */
for(intValCtr = 0; intValCtr < 141; intValCtr++)
arrZoom[4][intValCtr] = 0;
// Left-side slope of Zoom: Maximum Zoom In
double dblMaxZInL = 4;
for(intValCtr = 141; intValCtr < 161; intValCtr++, dblMaxZInL += .1)
arrZoom[4][intValCtr] = .5 * (Math.round(dblMaxZInL * 100.0) / 100.0) - 2;
for(intValCtr = 161; intValCtr < 201; intValCtr++)
arrZoom[4][intValCtr] = 1;
return arrZoom;
//================================================================//
}
}