【问题标题】:Search for an image within a group of images在一组图像中搜索图像
【发布时间】:2019-06-29 12:01:03
【问题描述】:

我有一堆图片 我想在图片中搜索特定图像 我想检查这个图像是否在矩阵中可用

<?php 
$ima="image1.PNG";

$md5image1 = md5(file_get_contents($ima));

$images=array( "image1.PNG","image2.PNG","image3.PNG","image4.PNG"  ); 
srand(time()); 
shuffle($images); 
    for ($i=0;$i<5;++$i)
    if ($ima == $images) {
       echo "yes";} 

    else {
       echo "no";
}
?>

【问题讨论】:

  • 我觉得你可以用in_array($ima, $images); ?
  • 或者你可以把if ($ima == $images)改成if ($ima == $images[$i])
  • 你为什么要md5(file_get_contents($ima));
  • 谢谢但是我还有一个问题,如果图片有一些添加,例如图片已添加到图片中间有一个大徽标当我寻找它时,我找不到图片可以加条件图片相似度比例65%接受,小于50%不接受

标签: php arrays image search


【解决方案1】:

试试这个

<?php 
$ima="image1.PNG";

$md5image1 = md5(file_get_contents($ima));

$images=array( "image1.PNG","image2.PNG","image3.PNG","image4.PNG"  ); 
srand(time()); 
shuffle($images); 

if (in_array("$ima", $images))
   {
         echo "Search found";
   }
    else
            {
              echo "Search not found";
            }
?>

【讨论】:

  • 感谢您现在工作 但是我还有一个问题,如果图片有一些添加,例如图片已添加到图片中间有一个大徽标当我寻找它时找不到图片可以加条件图片相似度比例65%接受,小于50%不接受
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-01
  • 1970-01-01
  • 2020-10-28
相关资源
最近更新 更多