Ejemplo n.º 1
0
 function findPortalId(AbstractPortalImage $pi)
 {
     $findHash = $pi->getHash();
     $matches = array();
     foreach ($this->_portals as $portalId => $hash) {
         $matches[$portalId] = ph_image_dist($findHash, $hash);
     }
     asort($matches);
     $matches = array_slice($matches, 0, 2);
     if (reset($matches) > 15) {
         return null;
     }
     if (end($matches) < 15) {
         return null;
     }
     return reset(array_keys($matches));
 }
Ejemplo n.º 2
0
$PATH_ORIG = "../phash/bilder";
$PATH_MOD = "../phash/bilder_mod";
$d = dir($PATH_ORIG);
$bilder = array();
while (false !== ($entry = $d->read())) {
    if ($entry == "." || $entry == ".." || !file_exists($PATH_MOD . "/" . $entry)) {
        continue;
    }
    $bilder[] = $entry;
}
$d->close();
$results = array();
for ($i = 0; $i <= sizeof($bilder); $i++) {
    if ($bilder[$i] == null) {
        break;
    }
    $image1 = ph_dct_imagehash($PATH_ORIG . "/" . $bilder[$i]);
    $image2 = ph_dct_imagehash($PATH_MOD . "/" . $bilder[$i]);
    $results[] = ph_image_dist($image1, $image2);
}
$graph = new Graph(350, 200, "auto");
$graph->SetScale("textlin");
$lineplot = new LinePlot($results);
$graph->Add($lineplot);
$lineplot->SetColor("orange");
//$lineplot->SetFillColor("darkorange@0.6");
$lineplot->SetWeight(2);
$lineplot->value->Show();
$lineplot->value->SetFont(FF_FONT0, FS_NORMAL);
$lineplot->value->SetColor("orange");
$graph->Stroke();