1 | <?php |
||
8 | class CropEntropy |
||
9 | { |
||
10 | /** |
||
11 | * @var Imagick |
||
12 | */ |
||
13 | protected $image = null; |
||
14 | |||
15 | /** |
||
16 | * CropEntropy constructor |
||
17 | * |
||
18 | * @param Imagick|null $image |
||
19 | */ |
||
20 | public function __construct(Imagick $image = null) |
||
28 | |||
29 | /** |
||
30 | * @return Imagick |
||
31 | */ |
||
32 | public function getImage() |
||
36 | |||
37 | /** |
||
38 | * Get the area in pixels for this image |
||
39 | * |
||
40 | * @return int |
||
41 | */ |
||
42 | public function area() |
||
47 | |||
48 | /** |
||
49 | * @param CropEntropy $b |
||
50 | * @return int |
||
51 | */ |
||
52 | public function compare(CropEntropy $b) |
||
63 | |||
64 | /** |
||
65 | * Calculate the entropy for this image. |
||
66 | * |
||
67 | * A higher value of entropy means more noise / liveliness / color / business |
||
68 | * |
||
69 | * @return float |
||
70 | * |
||
71 | * @see http://brainacle.com/calculating-image-entropy-with-python-how-and-why.html |
||
72 | * @see http://www.mathworks.com/help/toolbox/images/ref/entropy.html |
||
73 | */ |
||
74 | public function getGrayScaleEntropy() |
||
79 | |||
80 | /** |
||
81 | * |
||
82 | * @param ImagickPixel[] $histogram |
||
83 | * @param int $area |
||
84 | * @return float |
||
85 | */ |
||
86 | protected function getEntropy($histogram, $area) |
||
98 | |||
99 | /** |
||
100 | * @param int $width - The width of the region to be extracted |
||
101 | * @param int $height - The height of the region to be extracted |
||
102 | * @param int $x - X-coordinate of the top-left corner of the region to be extracted |
||
103 | * @param int $y -Y-coordinate of the top-left corner of the region to be extracted |
||
104 | * @return CropEntropy |
||
105 | */ |
||
106 | public function getRegion($width, $height, $x, $y) |
||
110 | } |
||
111 |