Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SURF/SIFT type image pattern matching library in PHP

i wanna know if there is some SURF library that is written in PHP available? From little findings that i did till now surf libraries are either in C++/C#, if some link to similar technologies that are built in PHP if provided it will be appreciated. I googled my way for some builtin features, the only thing that was close enough was Image Magick. But from comments it looks like pattern matching cannot be done in it.

Let me re define my self i just dont want to compare 2 images , lets say there is a Google logo with in an image, and there is an image of Google Logo as a separate image what i want to search if there is some image where Google's logo/image is reproduced.

like image 582
temp-learn Avatar asked Oct 20 '22 15:10

temp-learn


1 Answers

OpenCV is a great open source library for image processing and computer vision. I found a PHP wrapper (a detailed tutorial here), BUT it I am afraid that it doesn't wrap the SIFT/SURF code...

Reading your comment I saw you need to match two images. If your objective is to match a pattern (one image) against another image, you can use this example:

<?php
use OpenCV\Image as Image;
use OpenCV\Histogram as Histogram;

echo "Loading sample\n";
$im = Image::load("elephpant_sample.jpg", Image::LOAD_IMAGE_COLOR);
$im2 = Image::load("dragonbe_elephpants.jpg", Image::LOAD_IMAGE_COLOR);

for ($i = 0; $i < 6; $i++) {
$result = $im2->matchTemplate($im, $i);
$result->save("mt_output_$i.jpg");
}

In the case you are searching for objects, you can use the Haar Cascade part. Here is an example that detects faces in images.

like image 198
phyrox Avatar answered Oct 23 '22 05:10

phyrox