1 | <?php |
||
5 | class CropEntropy |
||
6 | { |
||
7 | /** |
||
8 | * @var \Imagick |
||
9 | */ |
||
10 | protected $image = null; |
||
11 | |||
12 | /** |
||
13 | * CropEntropy constructor |
||
14 | * |
||
15 | * @param \Imagick|null $image |
||
16 | */ |
||
17 | public function __construct(\Imagick $image = null) |
||
25 | |||
26 | /** |
||
27 | * @return \Imagick |
||
28 | */ |
||
29 | public function getImage() |
||
33 | |||
34 | /** |
||
35 | * Get the area in pixels for this image |
||
36 | * |
||
37 | * @return int |
||
38 | */ |
||
39 | public function area() |
||
44 | |||
45 | /** |
||
46 | * @param CropEntropy $b |
||
47 | * @return int |
||
48 | */ |
||
49 | public function compare(CropEntropy $b) |
||
61 | |||
62 | /** |
||
63 | * Calculate the entropy for this image. |
||
64 | * |
||
65 | * A higher value of entropy means more noise / liveliness / color / business |
||
66 | * |
||
67 | * @return float |
||
68 | * |
||
69 | * @see http://brainacle.com/calculating-image-entropy-with-python-how-and-why.html |
||
70 | * @see http://www.mathworks.com/help/toolbox/images/ref/entropy.html |
||
71 | */ |
||
72 | public function getGrayScaleEntropy() |
||
77 | |||
78 | /** |
||
79 | * |
||
80 | * @param \ImagickPixel[] $histogram |
||
81 | * @param int $area |
||
82 | * @return float |
||
83 | */ |
||
84 | protected function getEntropy($histogram, $area) |
||
96 | |||
97 | /** |
||
98 | * @param int $width - The width of the region to be extracted |
||
99 | * @param int $height - The height of the region to be extracted |
||
100 | * @param int $x - X-coordinate of the top-left corner of the region to be extracted |
||
101 | * @param int $y -Y-coordinate of the top-left corner of the region to be extracted |
||
102 | * @return CropEntropy |
||
103 | */ |
||
104 | public function slice($width, $height, $x, $y) |
||
108 | |||
109 | |||
110 | } |
||
111 |