我正在构建一个搜索图像引擎,因此我需要在数据库中检测相似/重复的图像,并且我找到了phasher。
这个类帮助我为每个图像创建散列字符串。我可以很容易地比较两个图像,但现在我想在一个大型数据库中搜索,看看一个特定的图像是否有任何克隆或相似的图像?
如何使用图像散列字符串进行搜索?
发布于 2015-06-16 02:22:29
我想我正在建立一个工具,看起来像你的,但搜索Facebook资料图片我称之为FBpp = "Facebook资料图片“;
我还没有完成它,它是我用来磨练我的编程技能的东西。
我想这就是你要找的。
<?php
//Require config.php file to connect with mysql server and the db.
require_once('config.php');
//Calling PHasher class file.
include_once('phasher/phasher.class.php');
$I = PHasher::Instance();
$testImage = "./avatar/4.jpg";
$hash = $I->FastHashImage($testImage);
$hex = $I->HashAsString($hash);
$result = mysql_query("SELECT `fid`,`hash` FROM `images`");
while($row = mysql_fetch_array($result)){
if($row['hash'] == $hex){
//echo $row['hash'];
$fid = $row['fid'];
echo "<a href='https://www.facebook.com/$fid/'><img src='https://graph.facebook.com/$fid/picture?type=large'></a>";
}
}https://stackoverflow.com/questions/19277528
复制相似问题