更新时间:2023-02-26 13:35:44
如果根据您的问题,您只想检测带水印的图像,您可以使用以下算法:
If according to your question, you just want to detect the images that are watermarked, you can use the following algorithm:
代码可能是这样的:
$no_of_pixels = what_you_got;
$matched = 0;
$thumbpixels = array();
$wmark = imagecreatefrompng("watermark.png");
list($width, $height) = getimagesize("watermark.png");
$tesimage = imagecreatefrompng("test.png");
for($h = 0; $h < $height; $h++){
for($w = 0; $w < $width; $w++){
if(imagecolorsforindex($testimage, imagecolorat($testimage, $w, $h)) == $thumbpixels[0]){
while($thumbpixels[$i++] === imagecolorsforindex($tesimage, imagecolorat($wmark, $w, $h)) && $no_of_pixels != $matched){
$matched++;
}
if($matched == $no_of_pixels) echo "Voila, we found it!";
}
}
}
只看到你的缩略图示例。如果您只想检测文字,可以尝试 tesseract-ocr 或 PhpOCR 。
您也可以考虑 PHPSane