Trivial changes, removing an unused variable, rename a method and so on

This commit is contained in:
travail 2015-10-08 21:30:38 +09:00
parent 65a634fb98
commit 3b3274a26a
2 changed files with 2 additions and 3 deletions

View File

@ -22,7 +22,6 @@ class PerceptionHash implements Algorithm
$row = array(); $row = array();
$rows = array(); $rows = array();
$col = array(); $col = array();
$cols = array();
for ($y = 0; $y < static::SIZE; $y++) { for ($y = 0; $y < static::SIZE; $y++) {
for ($x = 0; $x < static::SIZE; $x++) { for ($x = 0; $x < static::SIZE; $x++) {
$rgb = imagecolorsforindex($resized, imagecolorat($resized, $x, $y)); $rgb = imagecolorsforindex($resized, imagecolorat($resized, $x, $y));
@ -89,7 +88,7 @@ class PerceptionHash implements Algorithm
$sum += $pixels[$j] * cos($i * pi() * ($j + 0.5) / ($size)); $sum += $pixels[$j] * cos($i * pi() * ($j + 0.5) / ($size));
} }
$sum *= sqrt(2 / $size); $sum *= sqrt(2 / $size);
if ($i == 0) { if ($i === 0) {
$sum *= 1 / sqrt(2); $sum *= 1 / sqrt(2);
} }
$transformed[$i] = $sum; $transformed[$i] = $sum;

View File

@ -3,7 +3,7 @@
use Image\PerceptualHash; use Image\PerceptualHash;
use Image\PerceptualHash\Algorithm\PerceptionHash; use Image\PerceptualHash\Algorithm\PerceptionHash;
class PerceptualHashTest extends PHPUnit_Framework_TestCase class PerceptionHashTest extends PHPUnit_Framework_TestCase
{ {
public function setUp() public function setUp()
{ {