Add the method similarity()

This commit is contained in:
travail 2015-01-20 17:10:42 +09:00
parent f4f503047e
commit c58775dcc3

View File

@ -86,6 +86,11 @@ class PerceptualHash {
return (int)$diff;
}
public function similarity($file)
{
return 1 - ($this->compare($file) / strlen($this->bin));
}
protected function load($file)
{
if (!file_exists($file)) {