-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.php
More file actions
281 lines (244 loc) · 36.2 KB
/
Test.php
File metadata and controls
281 lines (244 loc) · 36.2 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?php
define("RED", 0);
define("GREEN", 1);
define("BLUE", 2);
function MaxPool(&$img){
// Get the size info from the input image
$width = imagesx($img);
$height = imagesy($img);
// Determine the size of the pool image.
$max_pool_img_width = $width / 2;
while(($max_pool_img_width % 2)>0){
$max_pool_img_width++;// if it wont evenly divide into 2... enlarge
}
$max_pool_img_height = $height / 2;
while(($max_pool_img_height % 2)>0){
$max_pool_img_height++;// if it wont evenly divide into 2... enlarge
}
// Allocate resource in memory for the image
$max_pool_img = imagecreatetruecolor($max_pool_img_width, $max_pool_img_height);
$background = imagecolorallocate($max_pool_img, 0, 0, 0);
$max_row = 0;
$max_col = 0;
// Max Pooling
for($row = 0; $row < $width; $row += 2){
for($col = 0; $col < $height; $col+= 2){
// C0 C1 C2
//R0 [p1] [p2] [..]
//R1 [p3] [p4] [..]
//R2 [..] [..] [..]
// Get color
$p1 = @imagecolorat($img, $row, $col);
// R+G+B
$p1_r = ($p1 >> 16) & 0xFF;
$p1_g = ($p1 >> 8) & 0xFF;
$p1_b = $p1 & 0xFF;
$p1_color = $p1_r + $p1_g + $p1_b;
// Get color
$p2 = @imagecolorat($img, $row, $col+1);
// R+G+B
$p2_r = ($p2 >> 16) & 0xFF;
$p2_g = ($p2 >> 8) & 0xFF;
$p2_b = $p2 & 0xFF;
$p2_color = $p2_r + $p2_g + $p2_b;
// Get color
$p3 = @imagecolorat($img, $row+1, $col);
// R+G+B
$p3_r = ($p3 >> 16) & 0xFF;
$p3_g = ($p3 >> 8) & 0xFF;
$p3_b = $p3 & 0xFF;
$p3_color = $p3_r + $p3_g + $p3_b;
// Get color
$p4 = @imagecolorat($img, $row+1, $col+1);
// R+G+B
$p4_r = ($p4 >> 16) & 0xFF;
$p4_g = ($p4 >> 8) & 0xFF;
$p4_b = $p4 & 0xFF;
$p4_color = $p4_r + $p4_g + $p4_b;
$color = $p1;
// Find the brightest pixel
$max_pixel = max($p1_color, $p2_color, $p3_color, $p4_color);
if($max_pixel == $p1_color){
$color = $p1;
}
elseif($max_pixel == $p2_color){
$color = $p2;
}
elseif($max_pixel == $p3_color){
$color = $p3;
}
else{
$color = $p4;
}
// Paint pooled pixel
imagesetpixel($max_pool_img, $max_row, $max_col, $color);
$max_col++;
}
$max_col = 0;
$max_row++;
}
return $max_pool_img;
}
function Monochrome(&$img, $color_channel){
// Get the size info from the input image
$width = imagesx($img);
$height = imagesy($img);
// Allocate resource in memory for the image
$monochrome = imagecreatetruecolor($width, $height);
$background = imagecolorallocate($monochrome, 0, 0, 0);
// Loop through pixels
for($row = 0; $row < $width; $row++){
for($col = 0; $col < $height; $col++){
// Get pixel color channels
$p = imagecolorat($img, $row, $col);
$colors = imagecolorsforindex($img, $p);
// Extract desired channel
if($color_channel == RED){
$pixelcolor = imagecolorallocate($monochrome, $colors['red'], 0, 0);
}
elseif($color_channel == GREEN){
$pixelcolor = imagecolorallocate($monochrome, 0, $colors['green'], 0);
}
elseif($color_channel == BLUE){
$pixelcolor = imagecolorallocate($monochrome, 0, 0, $colors['blue']);
}
else{
$pixelcolor = $background;
}
// Change pixel to contain pure channel
imagesetpixel($monochrome, $row, $col, $pixelcolor);
}
}
return $monochrome;
}
// Take an image with height and width and return
// an array of floats for the desired color channel
function Flatten(&$img, $color_channel){
// Get the size info from the input image
$width = imagesx($img);
$height = imagesy($img);
// the flattened pixel data is stored here
$pixels = array();
// Loop through pixels
for($row = 0; $row < $width; $row++){
for($col = 0; $col < $height; $col++){
// Get pixel color channels
$p = imagecolorat($img, $row, $col);
$colors = imagecolorsforindex($img, $p);
// Extract desired channel
if($color_channel == RED){
$pixels[] = ColorToFloat($colors['red']);
}
elseif($color_channel == GREEN){
$pixels[] = ColorToFloat($colors['green']);
}
elseif($color_channel == BLUE){
$pixels[] = ColorToFloat($colors['blue']);
}
else{
$pixels[] = 0.00;
}
}
}
return $pixels;
}
function ExtractHealthbarFromScreenshot(&$source_im){
$x1 = 95;
$y1 = 725;
$x2 = 298 - $x1;
$x2 = 298 - $x1;
$y2 = 730 - $y1; // 733 whole thing
return imagecrop($source_im, ['x' => 95, 'y' => 725, 'width' => $x2, 'height' => $y2]);
}
// example will echo 0 - 255
//for($i = 0; $i <= 255; $i++){
// echo $i . ' ' . ColorToFloat($i) . PHP_EOL;
//}
function ColorToFloat($value)
{
$max = 255;
$increment = $max / 100;
return ($value / $increment) / 100;
}
// example will echo 0 - 1
//for($i = 0; $i <= 1; $i+=0.01){
// echo $i . ' ' . FloatToColor($i) . PHP_EOL;
//}
function FloatToColor($value)
{
$max = 255;
$increment = $max / 100;
return round(($value * 100) * $increment);
}
$image_kernel = array(
array(-1, -1, -1),
array(-1, 8, -1),
array(-1, -1, -1)
);
$screenshots = 'screenshots';
$screenshot = '1025167102.81336.jpg'; // Change to your test image
// Load image
$health_bar_r = imagecreatefromjpeg(__DIR__ . DIRECTORY_SEPARATOR . $screenshots . DIRECTORY_SEPARATOR . $screenshot);
// Get image size
$width = imagesx($health_bar_r);
$height = imagesy($health_bar_r);
// Create image resources of the correct size
$health_bar_g = imagecreatetruecolor($width, $height);
$health_bar_b = imagecreatetruecolor($width, $height);
// Copy the image to the new image resources
imagecopy($health_bar_g, $health_bar_r, 0, 0, 0, 0, $width, $height);
imagecopy($health_bar_b, $health_bar_r, 0, 0, 0, 0, $width, $height);
// Extract healthbar if the image is full size
if($width >= 1280 && $height >= 800){
$health_bar_r = ExtractHealthbarFromScreenshot($health_bar_r);
$health_bar_g = ExtractHealthbarFromScreenshot($health_bar_g);
$health_bar_b = ExtractHealthbarFromScreenshot($health_bar_b);
}
// Split RGB Channels
$health_bar_r = Monochrome($health_bar_r, RED);
$health_bar_g = Monochrome($health_bar_g, GREEN);
$health_bar_b = Monochrome($health_bar_b, BLUE);
// Convolutions
imageconvolution($health_bar_r, $image_kernel, 1, -1);
imageconvolution($health_bar_g, $image_kernel, 1, -1);
imageconvolution($health_bar_b, $image_kernel, 1, -1);
// Pooling
$health_bar_r = MaxPool($health_bar_r);
$health_bar_g = MaxPool($health_bar_g);
$health_bar_b = MaxPool($health_bar_b);
$red_inputs = Flatten($health_bar_r, RED);
$green_inputs = Flatten($health_bar_g, GREEN);
$blue_inputs = Flatten($health_bar_b, BLUE);
// Destroy image resources
imagedestroy($health_bar_r);
imagedestroy($health_bar_g);
imagedestroy($health_bar_b);
// Load ANN
$train_file = (dirname(__FILE__) . "/finished.net");
if (!is_file($train_file)){
die("The file finished.net has not been created!" . PHP_EOL);
}
$ann = fann_create_from_file($train_file);
if ($ann) {
$input = array_merge($red_inputs, $green_inputs, $blue_inputs);
$result = fann_run($ann, $input);
echo $result[0] . ' ' . $result[1] . PHP_EOL;
// Hardcoded tests (uncomment to run):
/*
$input = array(0.019607843137255, 0.043137254901961, 0.043137254901961, 0.058823529411765, 0.031372549019608, 0.035294117647059, 0.019607843137255, 0.031372549019608, 0.03921568627451, 0.027450980392157, 0, 0.003921568627451, 0.007843137254902, 0.015686274509804, 0.031372549019608, 0.03921568627451, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.007843137254902, 0.015686274509804, 0, 0.007843137254902, 0, 0.007843137254902, 0.007843137254902, 0.015686274509804, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.035294117647059, 0.043137254901961, 0, 0.015686274509804, 0.019607843137255, 0.003921568627451, 0.023529411764706, 0.03921568627451, 0.023529411764706, 0.003921568627451, 0, 0.003921568627451, 0, 0, 0.011764705882353, 0.019607843137255, 0.007843137254902, 0.011764705882353, 0.56078431372549, 0.50588235294118, 0.77647058823529, 0.79607843137255, 0, 0, 0.95686274509804, 0.97647058823529, 0.14117647058824, 0.13725490196078, 0, 0, 0.019607843137255, 0.019607843137255, 0.043137254901961, 0.043137254901961, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0, 0.023529411764706, 0.007843137254902, 0.003921568627451, 0, 0.011764705882353, 0, 0, 0.019607843137255, 0.019607843137255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.007843137254902, 0.015686274509804, 0, 0.007843137254902, 0, 0.007843137254902, 0.007843137254902, 0.015686274509804, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.019607843137255, 0.015686274509804, 0.007843137254902, 0.023529411764706, 0, 0, 0.011764705882353, 0.007843137254902, 0.015686274509804, 0.019607843137255, 0.007843137254902, 0.031372549019608, 0.007843137254902, 0.007843137254902, 0.19607843137255, 0.18823529411765, 0.88235294117647, 0.89019607843137, 0, 0, 0.43137254901961, 0.4078431372549, 0, 0, 0.7921568627451, 0.79607843137255, 0.27058823529412, 0.25490196078431, 0.019607843137255, 0.019607843137255, 0.043137254901961, 0.043137254901961, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.019607843137255, 0.019607843137255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.031372549019608, 0.03921568627451, 0, 0.007843137254902, 0, 0.007843137254902, 0.007843137254902, 0.015686274509804, 0, 0, 0, 0, 0, 0, 0.019607843137255, 0.019607843137255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.019607843137255, 0.019607843137255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.019607843137255, 0.019607843137255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.019607843137255, 0.019607843137255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.031372549019608, 0.027450980392157, 0.4078431372549, 0.3843137254902, 0, 0, 0.3921568627451, 0.35294117647059, 0.011764705882353, 0, 0, 0);
$result = fann_run($ann, $input);
echo "(-1, -1) : " . $result[0] . ' ' . $result[1] . PHP_EOL;
$input = array(0, 0, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0.031372549019608, 0.031372549019608, 0, 0, 0.043137254901961, 0.050980392156863, 0.011764705882353, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.007843137254902, 0.011764705882353, 0.019607843137255, 0.031372549019608, 0.011764705882353, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0, 0.003921568627451, 0.007843137254902, 0.007843137254902, 0, 0, 0.007843137254902, 0.007843137254902, 0, 0, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0.019607843137255, 0.019607843137255, 0.007843137254902, 0.031372549019608, 0.007843137254902, 0.015686274509804, 0, 0.007843137254902, 0.011764705882353, 0.003921568627451, 0.031372549019608, 0.03921568627451, 0.007843137254902, 0.007843137254902, 0, 0, 0.047058823529412, 0, 0.035294117647059, 0.007843137254902, 0.019607843137255, 0.007843137254902, 0.047058823529412, 0.007843137254902, 0.019607843137255, 0, 0.031372549019608, 0.007843137254902, 0.031372549019608, 0.007843137254902, 0.047058823529412, 0.015686274509804, 0, 0.003921568627451, 0.011764705882353, 0.007843137254902, 0.019607843137255, 0.031372549019608, 0.011764705882353, 0.019607843137255, 0, 0.003921568627451, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0.007843137254902, 0.015686274509804, 0.011764705882353, 0.019607843137255, 0.011764705882353, 0.019607843137255, 0.011764705882353, 0.023529411764706, 0, 0.003921568627451, 0.011764705882353, 0.019607843137255, 0.011764705882353, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0.49803921568627, 0.47058823529412, 0, 0, 1, 1, 1, 1, 0, 0, 0.10588235294118, 0.12549019607843, 0, 0, 0.18823529411765, 0.21176470588235, 0.007843137254902, 0, 0.027450980392157, 0, 0.03921568627451, 0, 0.035294117647059, 0, 0.019607843137255, 0.007843137254902, 0.019607843137255, 0.007843137254902, 0.019607843137255, 0, 0.058823529411765, 0.03921568627451, 0, 0.015686274509804, 0.07843137254902, 0.043137254901961, 0.054901960784314, 0.066666666666667, 0, 0, 1, 1, 0.31372549019608, 0.27450980392157, 0.15294117647059, 0.16862745098039, 0.019607843137255, 0.023529411764706, 0.043137254901961, 0.015686274509804, 0.031372549019608, 0.007843137254902, 0.031372549019608, 0.007843137254902, 0.031372549019608, 0.007843137254902, 0.019607843137255, 0, 0.031372549019608, 0.007843137254902, 0.031372549019608, 0.007843137254902, 0.019607843137255, 0, 0.050980392156863, 0.03921568627451, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.25098039215686, 0.24705882352941, 0.16470588235294, 0.18823529411765, 0.44313725490196, 0.43529411764706, 0, 0, 0.78039215686275, 0.76862745098039, 0, 0, 0, 0, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0.019607843137255, 0.019607843137255, 0, 0, 0.007843137254902, 0.007843137254902, 0, 0.003921568627451, 0.011764705882353, 0.007843137254902, 0.023529411764706, 0.019607843137255, 0.007843137254902, 0.011764705882353, 0.007843137254902, 0.015686274509804, 0.011764705882353, 0.007843137254902, 0.023529411764706, 0.019607843137255, 0.023529411764706, 0.031372549019608, 0, 0, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.019607843137255, 0, 0, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.019607843137255, 0, 0, 0.007843137254902, 0.003921568627451, 0.019607843137255, 0.015686274509804, 0, 0.011764705882353, 0.007843137254902, 0.007843137254902, 0, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0, 0, 0, 0.023529411764706, 0.007843137254902, 0.007843137254902, 0.011764705882353, 0.019607843137255, 0.019607843137255, 0.043137254901961, 0, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.007843137254902, 0.019607843137255, 0, 0.007843137254902, 0.031372549019608, 0.031372549019608, 0.011764705882353, 0.007843137254902, 0.023529411764706, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.019607843137255, 0, 0, 0, 0.003921568627451, 0, 0, 0.011764705882353, 0.019607843137255, 0.011764705882353, 0.023529411764706, 0, 0.003921568627451, 0.011764705882353, 0, 0.011764705882353, 0.007843137254902, 0.098039215686275, 0.098039215686275, 0, 0, 0.36862745098039, 0.35294117647059, 1, 1, 0.9843137254902, 0.97647058823529, 0.043137254901961, 0.066666666666667, 0, 0, 0.03921568627451, 0.054901960784314, 0.007843137254902, 0, 0.086274509803922, 0.070588235294118, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.003921568627451, 0.019607843137255, 0, 0, 0.019607843137255, 0, 0.007843137254902, 0, 0, 0, 0.011764705882353, 0.031372549019608, 0.047058823529412, 0, 0, 0.015686274509804, 0.015686274509804, 0.047058823529412, 0.047058823529412, 1, 1, 0.090196078431373, 0.12941176470588, 0.019607843137255, 0, 0.15686274509804, 0.17647058823529, 0, 0, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.015686274509804, 0.007843137254902, 0, 0, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.4, 0.40392156862745, 0.011764705882353, 0.011764705882353, 0.27058823529412, 0.27058823529412, 0, 0, 0.64705882352941, 0.63921568627451, 0.27058823529412, 0.27058823529412, 0, 0, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0.007843137254902, 0.015686274509804, 0.035294117647059, 0.019607843137255, 0.011764705882353, 0.007843137254902, 0.011764705882353, 0.023529411764706, 0, 0.003921568627451, 0.011764705882353, 0.031372549019608, 0.011764705882353, 0.007843137254902, 0.007843137254902, 0, 0.007843137254902, 0.015686274509804, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0.043137254901961, 0.043137254901961, 0.007843137254902, 0.007843137254902, 0.031372549019608, 0.031372549019608, 0, 0, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.031372549019608, 0.031372549019608, 0, 0, 0.007843137254902, 0.015686274509804, 0.011764705882353, 0.007843137254902, 0.011764705882353, 0.007843137254902, 0.023529411764706, 0.031372549019608, 0, 0, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0, 0, 0.007843137254902, 0.015686274509804, 0.011764705882353, 0.007843137254902, 0.019607843137255, 0.031372549019608, 0.035294117647059, 0.043137254901961, 0, 0, 0.031372549019608, 0.031372549019608, 0.007843137254902, 0.007843137254902, 0, 0, 0.031372549019608, 0.03921568627451, 0.035294117647059, 0.019607843137255, 0.011764705882353, 0.007843137254902, 0.023529411764706, 0.035294117647059, 0, 0.003921568627451, 0.011764705882353, 0.031372549019608, 0.011764705882353, 0.007843137254902, 0.007843137254902, 0, 0.34901960784314, 0.34509803921569, 0, 0, 0.9921568627451, 0.93725490196078, 1, 1, 0.07843137254902, 0.094117647058824, 0.003921568627451, 0, 0.090196078431373, 0.10588235294118, 0.031372549019608, 0.047058823529412, 0.07843137254902, 0.031372549019608, 0.031372549019608, 0.031372549019608, 0.043137254901961, 0.027450980392157, 0.043137254901961, 0.023529411764706, 0.019607843137255, 0.043137254901961, 0.019607843137255, 0.023529411764706, 0.019607843137255, 0.019607843137255, 0.070588235294118, 0.035294117647059, 0, 0.015686274509804, 0.035294117647059, 0.035294117647059, 0.03921568627451, 0.058823529411765, 0.062745098039216, 0.066666666666667, 1, 1, 0.16470588235294, 0.13725490196078, 0.035294117647059, 0.054901960784314, 0, 0, 0.094117647058824, 0.050980392156863, 0.031372549019608, 0.019607843137255, 0.031372549019608, 0.019607843137255, 0.031372549019608, 0.019607843137255, 0.019607843137255, 0.007843137254902, 0.031372549019608, 0.019607843137255, 0.031372549019608, 0.019607843137255, 0.03921568627451, 0.027450980392157, 0.007843137254902, 0.007843137254902, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.17254901960784, 0.17254901960784, 0.17647058823529, 0.16470588235294, 0.28235294117647, 0.28627450980392, 0, 0, 0.29019607843137, 0.31764705882353, 0.058823529411765, 0.07843137254902, 0.11764705882353, 0.074509803921569);
$result = fann_run($ann, $input);
echo "(1, 1) : " . $result[0] . ' ' . $result[1] . PHP_EOL;
$input = array(0.019607843137255, 0.019607843137255, 0.043137254901961, 0.043137254901961, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.007843137254902, 0.007843137254902, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03921568627451, 0.019607843137255, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.03921568627451, 0.019607843137255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.16078431372549, 0.16862745098039, 0, 0, 0, 0, 0.03921568627451, 0.058823529411765, 0.086274509803922, 0.070588235294118, 0, 0, 0.49019607843137, 0.49411764705882, 0.27843137254902, 0.31764705882353, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0.003921568627451, 0.019607843137255, 0, 0.03921568627451, 0, 0.031372549019608, 0, 0.031372549019608, 0, 0.03921568627451, 0.003921568627451, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0.14509803921569, 0.12941176470588, 0, 0, 0.003921568627451, 0, 0.07843137254902, 0.070588235294118, 0.043137254901961, 0.058823529411765, 0, 0, 0.27058823529412, 0.28235294117647, 1, 1, 0.10980392156863, 0.086274509803922, 0.49411764705882, 0.26666666666667, 0.55686274509804, 0.13333333333333, 0.33333333333333, 0.074509803921569, 0.34509803921569, 0.3921568627451, 0.44313725490196, 0.52549019607843, 0.46666666666667, 0.53333333333333, 0.50588235294118, 0.42745098039216, 0.094117647058824, 0.12156862745098, 0.12156862745098, 0.13333333333333, 0, 0, 0.21176470588235, 0.03921568627451, 0.25490196078431, 0, 0.38823529411765, 0, 0, 0, 0.17647058823529, 0.18039215686275, 0.41176470588235, 0.44313725490196, 0.69019607843137, 0.69411764705882, 0, 0, 1, 1, 0.64313725490196, 0.70980392156863, 0, 0, 0.019607843137255, 0.019607843137255, 0.043137254901961, 0.043137254901961, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.019607843137255, 0.015686274509804, 0.007843137254902, 0, 0.011764705882353, 0, 0, 0, 0, 0.007843137254902, 0.007843137254902, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.019607843137255, 0.011764705882353, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0.019607843137255, 0.011764705882353, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.043137254901961, 0.043137254901961, 0, 0.007843137254902, 0.031372549019608, 0.027450980392157, 0.031372549019608, 0.031372549019608, 0, 0, 0.054901960784314, 0.050980392156863, 0.13725490196078, 0.13725490196078, 0.69019607843137, 0.69019607843137, 0, 0, 0.090196078431373, 0.10196078431373, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0.015686274509804, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.007843137254902, 0.015686274509804, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.066666666666667, 0.070588235294118, 0, 0, 0.043137254901961, 0.058823529411765, 0.03921568627451, 0.047058823529412, 0, 0, 0.047058823529412, 0.054901960784314, 0.082352941176471, 0.12156862745098, 0.42745098039216, 0.41176470588235, 1, 1, 0.10980392156863, 0.086274509803922, 0.48235294117647, 0.23529411764706, 0.50980392156863, 0.15686274509804, 0.31764705882353, 0.031372549019608, 0.32941176470588, 0.38039215686275, 0.4, 0.48627450980392, 0.47450980392157, 0.52156862745098, 0.50588235294118, 0.4156862745098, 0.023529411764706, 0.066666666666667, 0.10196078431373, 0.16470588235294, 0.003921568627451, 0, 0.18823529411765, 0.031372549019608, 0.22745098039216, 0, 0.36078431372549, 0, 0, 0, 0.015686274509804, 0, 0.38039215686275, 0.3843137254902, 0.007843137254902, 0.090196078431373, 0.68235294117647, 0.68235294117647, 0.6, 0.58823529411765, 0.7843137254902, 0.8078431372549, 0.37254901960784, 0.36078431372549, 0.031372549019608, 0.015686274509804, 0.047058823529412, 0.058823529411765, 0.003921568627451, 0.023529411764706, 0.050980392156863, 0.003921568627451, 0.027450980392157, 0.015686274509804, 0.011764705882353, 0.027450980392157, 0, 0, 0.058823529411765, 0.019607843137255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.054901960784314, 0.062745098039216, 0, 0, 0.019607843137255, 0.027450980392157, 0.043137254901961, 0.054901960784314, 0.003921568627451, 0.023529411764706, 0, 0, 0, 0, 0.61960784313725, 0.61960784313725, 0.10980392156863, 0.14901960784314, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0.003921568627451, 0.019607843137255, 0, 0.03921568627451, 0, 0.031372549019608, 0, 0.031372549019608, 0, 0.03921568627451, 0.003921568627451, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0, 0.019607843137255, 0.21176470588235, 0.17647058823529, 0, 0, 0, 0, 0.12941176470588, 0.10196078431373, 0.031372549019608, 0.11764705882353, 0, 0, 0.27450980392157, 0.23529411764706, 1, 1, 0.10980392156863, 0.07843137254902, 0.48627450980392, 0.26274509803922, 0.54901960784314, 0.10980392156863, 0.32549019607843, 0.035294117647059, 0.32941176470588, 0.37647058823529, 0.41960784313725, 0.50588235294118, 0.47450980392157, 0.52156862745098, 0.50588235294118, 0.4156862745098, 0.14509803921569, 0.14901960784314, 0.11372549019608, 0.17254901960784, 0, 0.031372549019608, 0.23921568627451, 0.019607843137255, 0.28627450980392, 0, 0.36470588235294, 0, 0, 0, 0.25098039215686, 0.30588235294118, 0.28627450980392, 0.30588235294118, 0.35294117647059, 0.33725490196078, 0.058823529411765, 0.11764705882353, 1, 1, 0, 0, 0.10588235294118, 0.10196078431373);
$result = fann_run($ann, $input);
echo "(-1, -1) : " . $result[0] . ' ' . $result[1] . PHP_EOL;
$input = array(0.007843137254902, 0.019607843137255, 0.031372549019608, 0.050980392156863, 0.031372549019608, 0.054901960784314, 0.031372549019608, 0.035294117647059, 0.007843137254902, 0.015686274509804, 0.007843137254902, 0.011764705882353, 0.019607843137255, 0.027450980392157, 0, 0, 0.03921568627451, 0.023529411764706, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.07843137254902, 0.066666666666667, 0.10196078431373, 0.062745098039216, 0.10980392156863, 0.12156862745098, 0.007843137254902, 0.011764705882353, 0.16862745098039, 0.17647058823529, 0, 0, 0.29019607843137, 0.30588235294118, 0, 0, 1, 1, 0.32941176470588, 0.33333333333333, 0, 0.03921568627451, 0.10588235294118, 0.13725490196078, 0.12941176470588, 0.10588235294118, 0.054901960784314, 0.007843137254902, 0.007843137254902, 0.003921568627451, 0.023529411764706, 0, 0.027450980392157, 0.003921568627451, 0.074509803921569, 0.070588235294118, 0, 0, 0.082352941176471, 0.015686274509804, 0.011764705882353, 0.019607843137255, 0, 0.047058823529412, 0.007843137254902, 0.019607843137255, 0.066666666666667, 0, 0.074509803921569, 0.027450980392157, 0.054901960784314, 0, 0.054901960784314, 0.047058823529412, 0.007843137254902, 0.027450980392157, 0.03921568627451, 0.12156862745098, 0.047058823529412, 0, 0.03921568627451, 0, 0.062745098039216, 0, 0.10588235294118, 0, 0.019607843137255, 0.03921568627451, 0, 0.003921568627451, 0.062745098039216, 0.043137254901961, 0.031372549019608, 0.027450980392157, 0.074509803921569, 0.015686274509804, 0.12941176470588, 0.058823529411765, 0.007843137254902, 0.035294117647059, 0.058823529411765, 0.043137254901961, 0.086274509803922, 0.090196078431373, 0.027450980392157, 0, 0, 0.098039215686275, 0.15686274509804, 0.090196078431373, 0.019607843137255, 0, 0, 0.003921568627451, 0.019607843137255, 0.003921568627451, 0.18039215686275, 0.16862745098039, 0.086274509803922, 0.15294117647059, 0, 0.058823529411765, 0.1921568627451, 0.15294117647059, 0.17647058823529, 0.094117647058824, 0.050980392156863, 0.007843137254902, 0.023529411764706, 0.019607843137255, 0.023529411764706, 0.043137254901961, 0.03921568627451, 0.12156862745098, 0.03921568627451, 0.011764705882353, 0.035294117647059, 0.043137254901961, 0.07843137254902, 0.050980392156863, 0.098039215686275, 0.07843137254902, 0.050980392156863, 0.12941176470588, 0.13333333333333, 0.03921568627451, 0.10196078431373, 0.023529411764706, 0.28627450980392, 0.1843137254902, 0.082352941176471, 0.10980392156863, 0.043137254901961, 0.11764705882353, 0.023529411764706, 0.07843137254902, 0.027450980392157, 0.090196078431373, 0.027450980392157, 0.027450980392157, 0.16862745098039, 0, 0.14117647058824, 0, 0.10980392156863, 0, 0.21960784313725, 0.1921568627451, 0.003921568627451, 0, 0.11372549019608, 0.17254901960784, 0.082352941176471, 0.13725490196078, 0, 0, 0.72549019607843, 0.72156862745098, 0.24313725490196, 0.21960784313725, 0.15294117647059, 0.12941176470588, 0.30980392156863, 0.28627450980392, 0.16078431372549, 0.14901960784314, 0, 0, 0.68235294117647, 0.64313725490196, 0.082352941176471, 0.082352941176471, 0, 0, 0.043137254901961, 0.043137254901961, 0.007843137254902, 0.003921568627451, 0.015686274509804, 0.003921568627451, 0.035294117647059, 0.027450980392157, 0, 0, 0, 0, 0.007843137254902, 0.011764705882353, 0.019607843137255, 0.011764705882353, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0, 0.007843137254902, 0.090196078431373, 0.074509803921569, 0.066666666666667, 0.062745098039216, 0.043137254901961, 0.043137254901961, 0.031372549019608, 0.031372549019608, 0.090196078431373, 0.090196078431373, 0, 0, 0.32549019607843, 0.31764705882353, 1, 1, 0.32549019607843, 0.36470588235294, 0, 0.03921568627451, 0.070588235294118, 0.14117647058824, 0.094117647058824, 0.10588235294118, 0.031372549019608, 0.007843137254902, 0, 0.003921568627451, 0.023529411764706, 0, 0, 0.015686274509804, 0.10588235294118, 0.10980392156863, 0, 0, 0.031372549019608, 0.023529411764706, 0, 0, 0, 0.050980392156863, 0.007843137254902, 0.007843137254902, 0.031372549019608, 0, 0.054901960784314, 0, 0.03921568627451, 0, 0.054901960784314, 0.023529411764706, 0.007843137254902, 0.003921568627451, 0.03921568627451, 0.098039215686275, 0.023529411764706, 0, 0.015686274509804, 0.003921568627451, 0.03921568627451, 0.003921568627451, 0.066666666666667, 0, 0.003921568627451, 0.035294117647059, 0, 0.011764705882353, 0.062745098039216, 0.031372549019608, 0, 0.011764705882353, 0.070588235294118, 0, 0.14509803921569, 0.047058823529412, 0, 0.015686274509804, 0.047058823529412, 0.043137254901961, 0.011764705882353, 0.027450980392157, 0.015686274509804, 0, 0, 0.098039215686275, 0.14509803921569, 0.070588235294118, 0, 0.015686274509804, 0, 0.003921568627451, 0, 0.007843137254902, 0.043137254901961, 0.062745098039216, 0.10196078431373, 0.13333333333333, 0, 0.10980392156863, 0.18823529411765, 0.11764705882353, 0.17647058823529, 0.094117647058824, 0.031372549019608, 0, 0.007843137254902, 0, 0, 0.011764705882353, 0.062745098039216, 0.086274509803922, 0.047058823529412, 0.035294117647059, 0.007843137254902, 0.027450980392157, 0.035294117647059, 0.015686274509804, 0.050980392156863, 0.027450980392157, 0.058823529411765, 0.090196078431373, 0.13725490196078, 0.094117647058824, 0.10196078431373, 0, 0.15294117647059, 0.086274509803922, 0.066666666666667, 0.13725490196078, 0.035294117647059, 0.10980392156863, 0, 0.066666666666667, 0.03921568627451, 0.066666666666667, 0.019607843137255, 0, 0.13725490196078, 0, 0.16470588235294, 0, 0.1843137254902, 0.07843137254902, 0.011764705882353, 0.003921568627451, 0.10588235294118, 0.10588235294118, 0.086274509803922, 0.07843137254902, 0.050980392156863, 0.10588235294118, 0.035294117647059, 0.2, 0.52156862745098, 0.49019607843137, 0, 0, 0.023529411764706, 0.043137254901961, 0.43529411764706, 0.38823529411765, 0, 0, 0.31372549019608, 0.27058823529412, 0, 0, 0.63921568627451, 0.63529411764706, 0.27843137254902, 0.27843137254902, 0.003921568627451, 0.019607843137255, 0.074509803921569, 0.035294117647059, 0.015686274509804, 0.027450980392157, 0.035294117647059, 0.015686274509804, 0, 0.003921568627451, 0.019607843137255, 0.027450980392157, 0, 0.003921568627451, 0.050980392156863, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.07843137254902, 0.07843137254902, 0.090196078431373, 0.10588235294118, 0.14901960784314, 0.15686274509804, 0.019607843137255, 0.027450980392157, 0.23137254901961, 0.23921568627451, 0, 0, 0.33333333333333, 0.36862745098039, 0, 0, 1, 1, 0.36078431372549, 0.36470588235294, 0, 0.03921568627451, 0.10588235294118, 0.14117647058824, 0.12941176470588, 0.10588235294118, 0.054901960784314, 0.007843137254902, 0.007843137254902, 0.003921568627451, 0.023529411764706, 0, 0.043137254901961, 0.015686274509804, 0.062745098039216, 0.058823529411765, 0, 0, 0.043137254901961, 0.043137254901961, 0, 0.007843137254902, 0.035294117647059, 0.019607843137255, 0.03921568627451, 0.03921568627451, 0.043137254901961, 0, 0.043137254901961, 0, 0.10196078431373, 0.035294117647059, 0.07843137254902, 0.047058823529412, 0.031372549019608, 0.027450980392157, 0.062745098039216, 0.12156862745098, 0.023529411764706, 0.011764705882353, 0.015686274509804, 0.015686274509804, 0.03921568627451, 0.015686274509804, 0.066666666666667, 0, 0.027450980392157, 0.03921568627451, 0.031372549019608, 0.031372549019608, 0.082352941176471, 0.035294117647059, 0.019607843137255, 0.058823529411765, 0.086274509803922, 0.003921568627451, 0.16862745098039, 0.07843137254902, 0.015686274509804, 0.023529411764706, 0.07843137254902, 0.070588235294118, 0.011764705882353, 0.03921568627451, 0.007843137254902, 0.015686274509804, 0, 0.12549019607843, 0.17647058823529, 0.070588235294118, 0, 0.031372549019608, 0, 0.003921568627451, 0, 0.031372549019608, 0.047058823529412, 0.03921568627451, 0.14509803921569, 0.13333333333333, 0.003921568627451, 0.10196078431373, 0.2078431372549, 0.12156862745098, 0.19607843137255, 0.12156862745098, 0.023529411764706, 0, 0.035294117647059, 0, 0.015686274509804, 0.019607843137255, 0.03921568627451, 0.054901960784314, 0.082352941176471, 0.054901960784314, 0.003921568627451, 0.023529411764706, 0.011764705882353, 0, 0.015686274509804, 0.007843137254902, 0.11764705882353, 0.12156862745098, 0.17647058823529, 0.13725490196078, 0.094117647058824, 0.015686274509804, 0.047058823529412, 0.019607843137255, 0.13333333333333, 0.17647058823529, 0.066666666666667, 0.10588235294118, 0.054901960784314, 0.03921568627451, 0.023529411764706, 0.090196078431373, 0.035294117647059, 0.003921568627451, 0.16078431372549, 0, 0.14509803921569, 0, 0.086274509803922, 0.011764705882353, 0.14509803921569, 0.15686274509804, 0.047058823529412, 0.031372549019608, 0.070588235294118, 0.12549019607843, 0.2156862745098, 0.23137254901961, 0.098039215686275, 0.25882352941176, 0.45098039215686, 0.42352941176471, 0.003921568627451, 0, 0.35686274509804, 0.4078431372549, 0.094117647058824, 0.082352941176471, 0.32156862745098, 0.27450980392157, 0.003921568627451, 0, 0.29803921568627, 0.27058823529412, 0.11764705882353, 0.11764705882353, 0.082352941176471, 0.074509803921569);
$result = fann_run($ann, $input);
echo "(1, -1) : " . $result[0] . ' ' . $result[1] . PHP_EOL;
*/
fann_destroy($ann);
} else {
die("Invalid file format" . PHP_EOL);
}