1 | <?php |
||
16 | class CropEntropy |
||
17 | { |
||
18 | /** |
||
19 | * @var Imagick |
||
20 | */ |
||
21 | protected $image = null; |
||
22 | |||
23 | /** |
||
24 | * @var bool |
||
25 | */ |
||
26 | protected $debug; |
||
27 | |||
28 | /** |
||
29 | * CropEntropy constructor |
||
30 | * |
||
31 | * @param Imagick|null $image |
||
32 | */ |
||
33 | public function __construct(Imagick $image = null) |
||
41 | |||
42 | public function debugOn() |
||
46 | |||
47 | public function debugOff() |
||
51 | |||
52 | /** |
||
53 | * @return Imagick |
||
54 | */ |
||
55 | public function getImage() |
||
59 | |||
60 | /** |
||
61 | * @param int $width - The width of the region to be extracted |
||
62 | * @param int $height - The height of the region to be extracted |
||
63 | * @param int $x - X-coordinate of the top-left corner of the region to be extracted |
||
64 | * @param int $y -Y-coordinate of the top-left corner of the region to be extracted |
||
65 | * @return CropEntropy |
||
66 | */ |
||
67 | public function getRegion($width, $height, $x, $y) |
||
71 | |||
72 | /** |
||
73 | * Get the area in pixels for this image |
||
74 | * |
||
75 | * @return int |
||
76 | */ |
||
77 | public function area() |
||
82 | |||
83 | /** |
||
84 | * @param CropEntropy $b |
||
85 | * @return int |
||
86 | */ |
||
87 | public function compare(CropEntropy $b) |
||
99 | |||
100 | /** |
||
101 | * Calculate the entropy for this image. |
||
102 | * |
||
103 | * A higher value of entropy means more noise / liveliness / color / business |
||
104 | * |
||
105 | * @return float |
||
106 | * |
||
107 | * @see http://brainacle.com/calculating-image-entropy-with-python-how-and-why.html |
||
108 | * @see http://www.mathworks.com/help/toolbox/images/ref/entropy.html |
||
109 | */ |
||
110 | public function getGrayScaleEntropy() |
||
115 | |||
116 | /** |
||
117 | * |
||
118 | * @param string $axis - must be either 'x' or 'y' |
||
119 | * @param $sliceSize |
||
120 | * @return int |
||
121 | */ |
||
122 | public function getMidPoint($axis, $sliceSize) |
||
167 | |||
168 | /** |
||
169 | * |
||
170 | * @param ImagickPixel[] $histogram |
||
171 | * @param int $area |
||
172 | * @return float |
||
173 | */ |
||
174 | protected function getEntropy($histogram, $area) |
||
186 | |||
187 | /** |
||
188 | * @param int $x |
||
189 | * @param int $sliceSize |
||
190 | * @return CropEntropy |
||
191 | */ |
||
192 | public function getVerticalSlice($x, $sliceSize) |
||
197 | |||
198 | /** |
||
199 | * @param int $y |
||
200 | * @param int $sliceSize |
||
201 | * @return CropEntropy |
||
202 | */ |
||
203 | public function getHorizontalSlice($y, $sliceSize) |
||
208 | |||
209 | /** |
||
210 | * @param int $x1 |
||
211 | * @param int $y1 |
||
212 | * @param int $x2 |
||
213 | * @param int $y2 |
||
214 | * @param strint $fillColor |
||
215 | */ |
||
216 | public function rectDraw($x1, $y1, $x2, $y2, $fillColor) |
||
225 | |||
226 | /** |
||
227 | * @param int $x |
||
228 | * @param int $y |
||
229 | * @param string $text |
||
230 | * @param int $angle - 0 to 350 |
||
231 | */ |
||
232 | public function drawText($x, $y, $text, $angle) |
||
239 | |||
240 | /** |
||
241 | * @param string $axis |
||
242 | * @param int $sliceSize |
||
243 | * @param float $value |
||
244 | * @param int $currentPos |
||
245 | * @param array $size |
||
246 | */ |
||
247 | protected function printDebug($axis, $sliceSize, $value, $currentPos, $size) |
||
260 | } |
||
261 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: