コード例 #1
0
ファイル: functions.php プロジェクト: 25mordad/picodico
function findPixOrderSim($db, $wd, $cc)
{
    require 'files/image.compare.class.php';
    $appRs = $db->rawQuery("SELECT * FROM pictures as p INNER JOIN approve as a ON a.id_picture=p.id where id_word IN (SELECT id FROM words where translation=? )  and (a.approve - a.disapprove > 0) ORDER BY a.approve DESC LIMIT 10", array($wd));
    $CI = new compareImages();
    foreach ($appRs as $row) {
        echo $row['url'];
        echo $CI->compare($row['url'], $row['url']);
    }
    return $db->rawQuery("SELECT * FROM pictures LIMIT 100", array($wd));
}
コード例 #2
0
ファイル: compare.php プロジェクト: ajmalazeez007/StartUpBox
        if (!$i1 || !$i2) {
            return false;
        }
        $i1 = $this->resizeImage($i1, $a);
        $i2 = $this->resizeImage($i2, $b);
        imagefilter($i1, IMG_FILTER_GRAYSCALE);
        imagefilter($i2, IMG_FILTER_GRAYSCALE);
        $colorMean1 = $this->colorMeanValue($i1);
        $colorMean2 = $this->colorMeanValue($i2);
        $bits1 = $this->bits($colorMean1);
        $bits2 = $this->bits($colorMean2);
        $hammeringDistance = 0;
        for ($a = 0; $a < 64; $a++) {
            if ($bits1[$a] != $bits2[$a]) {
                $hammeringDistance++;
            }
        }
        return $hammeringDistance;
    }
}
$comp_imgs = new compareImages();
$value = $comp_imgs->compare($_POST['img1'], $_POST['img2']);
if ($value == 0) {
    echo "The images are exact same.";
} else {
    if ($value > 0 && $value < 8) {
        echo "The images are more or less same but vary in physical factors";
    } else {
        echo "The images are more likely to be different.";
    }
}
コード例 #3
0
ファイル: demo.php プロジェクト: abininlive/Startup-Box
<?php

require 'image.compare.class.php';
/*
	these two images are almost the same so the hammered distance will be less than 10
	try it with images like this:
		1. the example images
		2. two complatly different image
		3. the same image (returned number should be 0)
		4. the same image but with different size, even different aspect ratio (returned number should be 0)
	you will see how the returned number will represent the similarity of the images.
*/
$class = new compareImages();
echo $class->compare('3.png', '3.png');
コード例 #4
0
ファイル: forminput.php プロジェクト: rohithkd/imagecompare
<p>The Image comparison rank is:
<?php 
require 'image.compare.class.php';
$class = new compareImages();
$firstone = $_POST['i1'];
$secondone = $_POST['i2'];
echo $class->compare($firstone, $secondone);
?>
 
コード例 #5
0
ファイル: example.php プロジェクト: nvthaovn/CompareImage
$image2 = 'image2.jpg';
//$diff = $compareMachine->compareWith($image2); //easy
$image2Hash = $compareMachine->hasStringImage($image2);
$diff = $compareMachine->compareHash($image2Hash);
echo "Image 2: <img src='{$image2}'/><br/>";
echo 'Image 2 Hash :' . $image2Hash . '<br/>';
echo 'Different rates (image1 Vs image2): ' . $diff;
if ($diff > 11) {
    echo ' => 2 different image';
} else {
    echo ' => duplicate image';
}
echo '<br/>-------------------------------------------------------------<br/>';
/* Get hash string from image*/
$image3 = 'image3.jpg';
$compareMachine = new compareImages($image3);
$image3Hash = $compareMachine->getHasString();
echo "Image 3: <img src='{$image3}'/><br/>";
echo 'Image 3 Hash :' . $image3Hash . '<br/>';
/* Compare this image with an other image*/
$image4 = 'image4.jpg';
$image4Hash = $compareMachine->hasStringImage($image4);
$diff = $compareMachine->compareHash($image4Hash);
echo "Image 4: <img src='{$image4}'/><br/>";
echo 'Image 4 Hash :' . $image4Hash . '<br/>';
echo 'Different rates (image3 Vs image4): ' . $diff;
if ($diff > 11) {
    echo ' => 2 different image';
} else {
    echo ' => duplicate image';
}
コード例 #6
0
ファイル: compare.php プロジェクト: ankitathomas/sbox
            if ($bits1[$a] != $bits2[$a]) {
                $hammeringDistance++;
            }
        }
        return $hammeringDistance;
    }
}
?>

<?php 
if (!isset($_POST["image1"]) || !isset($_POST["image2"])) {
    header('Location: f.html');
}
$url1 = $_POST["image1"];
$url2 = $_POST["image2"];
$comparer = new compareImages();
$diff = $comparer->compare($url1, $url2);
$percentdiff = (64 - $diff) * 1.5625;
?>

<!doctype html>
<html>
<title>Image Compare</title>
<meta charset="utf-8"/>
<body>
<img width="439" height="80" src=
<?php 
echo "\"" . $url1 . "\"";
?>
></img>&nbsp;<img width="439" height="80" src=
<?php 
コード例 #7
0
ファイル: image.php プロジェクト: vishnusankar94/project
    {
        $i1 = $this->createImage($a);
        $i2 = $this->createImage($b);
        if (!$i1 || !$i2) {
            return false;
        }
        $cnt = 0;
        $c = 0;
        $width = imagesx($i1);
        $height = imagesy($i1);
        for ($x = 0; $x < $width; $x++) {
            for ($y = 0; $y < $height; $y++) {
                // pixel color at (x, y)
                $color = imagecolorat($i1, $x, $y);
                $color1 = imagecolorat($i2, $x, $y);
                if ($color == $color1) {
                    $c = $c + 1;
                }
                $cnt = $cnt + 1;
            }
        }
        $p = $c / $cnt * 100;
        echo '<br>PIXEL WISE:The images are' . $p . '% similar';
    }
}
$im = new compareImages();
$res = $im->compare($a, $b);
$r = (64 - $res) / 64;
$re = $r * 100;
echo '<br>STRUCTURALLY: The images are' . $re . '%similar';
$im->comparep($a, $b);
コード例 #8
0
ファイル: main.php プロジェクト: rubinaibrahim/StartUp_Test
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php 
require_once 'class.compareImages.php';
$img1 = $_POST['id1'];
$img2 = $_POST['id2'];
$t = new compareImages();
$t->compare($img1, $img2);
?>
</body>
</html>
コード例 #9
0
ファイル: demo.php プロジェクト: trero/patata
<?php

require 'image.compare.class.php';
/*
	these two images are almost the same so the hammered distance will be less than 10
	try it with images like this:
		1. the example images
		2. two complatly different image
		3. the same image (returned number should be 0)
		4. the same image but with different size, even different aspect ratio (returned number should be 0)
	you will see how the returned number will represent the similarity of the images.
*/
$class = new compareImages();
echo $class->compare('img/monna-1.jpg', 'img/monna-17.jpg');
コード例 #10
0
ファイル: similar.php プロジェクト: 25mordad/picodico
<?php

/**
 * Project: PicoDico
 * File:    similar.php
 *
 */
//
session_start();
require 'files/require.php';
require 'files/functions.php';
require 'files/image.compare.class.php';
//
echo '<center><img src="' . $_GET['source'] . '"  width="200" ></center>';
echo "<hr>";
$results = findPix($db, $_GET['word']);
$CI = new compareImages();
for ($i = $_GET['from']; $i < $_GET['from'] + 5; $i++) {
    if (isset($results[$i]['url'])) {
        $similarity = $CI->compare($_GET['source'], $results[$i]['url']);
        echo '<img src="' . $results[$i]['url'] . '"  width="100" > similarity: ' . $similarity;
        echo "<hr>";
        $data = array("word" => $_GET['word'], "language" => $_GET['language'], "source" => $_GET['source'], "similar" => $results[$i]['url'], "similarity" => $similarity);
        $db->insert('similar', $data);
    }
}
if (isset($results[$i + 1]['url'])) {
    echo "<a href='?from={$i}&source={$_GET['source']}&word={$_GET['word']}&language={$_GET['language']}'  > Next Page </a>";
}
コード例 #11
0
$dir = new DirectoryIterator($directryName);
foreach ($dir as $fileinfo) {
    $files[$fileinfo->getMTime()] = $fileinfo->getFilename();
}
//krsort will sort in reverse order
krsort($files);
//just print out the file names
//excluding this file (named index.php and the dir "." )
$baseImage = 'theft 2.jpg';
$time = time();
$imgNames = array();
$i = 0;
foreach ($files as $file) {
    $imgCheck = mysql_query("select * from check where liveimage=='{$file}' ");
    if (!$imgCheck) {
        echo $file;
        echo "&nbsp;&nbsp;&nbsp;";
        $class = new compareImages();
        $cmp = $class->compare($directryName . $file, $directryName . $baseImage);
        echo $cmp;
        print "</br>";
        $imgInsert = mysql_query("INSERT INTO `check`( `liveimage`, `baseimage`, `compvalue`, `time`) VALUES ('{$file}','{$baseImage}','{$cmp}','{$time}');") or die(mysql_error());
        if ($cmp < 30) {
            echo "cmp>0 ::" . $i;
            echo "<br />";
            $alertimage = $directryName . $file;
            $imgNames[++$i] = $alertimage;
        }
    }
}
emailalert($imgNames);
コード例 #12
0
$content1 = file_get_contents($content1);
//Store in the filesystem.
chmod("1.jpg", 0644);
$fp = fopen("1.jpg", "w");
fwrite($fp, $content1);
fclose($fp);
//Get the file
$_POST['i2'];
$content2 = $_POST['i2'];
$content2 = file_get_contents($content2);
//Store in the filesystem.
chmod("2.jpg", 0644);
$fp = fopen("2.jpg", "w");
fwrite($fp, $content2);
fclose($fp);
$class = new compareImages();
echo $class->compare('1.jpg', '2.jpg');
class compareImages
{
    private function mimeType($i)
    {
        /*returns array with mime type and if its jpg or png. Returns false if it isn't jpg or png*/
        $mime = getimagesize($i);
        $return = array($mime[0], $mime[1]);
        switch ($mime['mime']) {
            case 'image/jpeg':
                $return[] = 'jpg';
                return $return;
            case 'image/png':
                $return[] = 'png';
                return $return;
コード例 #13
0
ファイル: index.php プロジェクト: sridevshyam/ImageCmp
<html>
<body>
<?php 
if (!isset($_POST['id1'])) {
    ?>
<form method="post">
First URL:<br>
<input type="text" name="id1">
<br>
Second URL:<br>
<input type="text" name="id2">
<button>Submit</button>
</form>
<?php 
} else {
    $id1 = $_POST['id1'];
    $id2 = $_POST['id2'];
    require 'index2.php';
    $class = new compareImages();
    echo "Difference Grading = ";
    echo $class->compare($id1, $id2);
}
?>
</body>
</html>