您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php 以图搜图

2024/12/14 5:07:38发布27次查看
感知哈希算法 count=5 匹配最相似 count 10两张不同的图片 var_dump(imagehash::run(./1.png,./psb.jpg)); 源地址:http://www.haowei.me/archives/1261.html ?phpclass imagehash {const file_not_found = '-1';const file_extname_illegal = '-2';private
感知哈希算法
count count > 10 两张不同的图片
var_dump(imagehash::run('./1.png', './psb.jpg'));
源地址: http://www.haowei.me/archives/1261.html
gethashvalue($src1); $hash2 = $self->gethashvalue($src2); if(strlen($hash1) !== strlen($hash2)) return false; $count = 0; $len = strlen($hash1); for($i = 0; $i < $len; $i++) if($hash1[$i] !== $hash2[$i]) $count++; return $count getimage($file); imagecopyresampled($img, $src, 0, 0, 0, 0, $w, $h, $src_w, $src_h); imagedestroy($src); $total = 0; $array = array(); for( $y = 0; $y 8) & 0xff; if(!isset($array[$y])) $array[$y] = array(); $array[$y][$x] = $gray; $total += $gray; } } imagedestroy($img); $average = intval($total / ($w * $h * 2)); $hash = ''; for($y = 0; $y < $h; $y++) { for($x = 0; $x = $average) ? '1' : '0'; } } var_dump($hash); return $hash; } }
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product