-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetRoute.php
More file actions
43 lines (29 loc) · 734 Bytes
/
Copy pathgetRoute.php
File metadata and controls
43 lines (29 loc) · 734 Bytes
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
<?php
$base = "C:/xampp/htdocs/www/badapple";
$xPos = $_GET["x"];
$yPos = $_GET["y"];
// number of frame in the video
$nbImg = 4383;
for($i = 0; $i < $nbImg; $i++) {
// get color info on a specific time
$image = imagecreatefrompng($base . "/pngs/png" . $i + 1 . ".png");
$rgb = imagecolorat($image, $xPos , $yPos);
// turn it into rgb
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
// and finaly in luminance value
// if it's possible to go from imagecolorat() to lum directly it would be faster!
$lum = 0.2126 * $r + 0.7152 * $g + 0.0722 * $b;
// 0 black
// 1 gray
// 2 white
if($lum < 85) {
echo(0);
} elseif ($lum > 85 && $lum < 170) {
echo(1);
} else {
echo(2);
}
}
?>