Jump to content

Sift On A Server


TheNavigator

Recommended Posts

For those who don't know SIFT, http://en.wikipedia.org/wiki/Scale-invariant_feature_transform

 

Here's an example of how it works.

 

I want to use that algorithm to compare 2 images and output a similarity %. In other words, a function/file that takes 2 URLs of images as parameters (that are local actually), and then output the similarity percentage. Can this be done in PHP? And if it's true, how?

 

The point is that the algorithm is very complicated, and as I saw that the actual implementations of the algorithm in life actual applications in the whole world is only 4. 1 in C#, one in C, one in C++ and one in another language that I don't really remember. How can this be implemented?

 

I've worked on algorithms for a year, but this is something really, really challenging.

 

I don't know if that's the right section for posting this, so if it isn't, please move the topic.

 

Thanks.

Link to comment
Share on other sites

Yeah most likely if the algorithim is just crunching numbers based on pixels and colors but it would probably be quite slow. Also PHPs floating point precision is not so good if that is a factor too.

 

If your look at the PHP manual at the PHP image librarys that might be a good starting point.

 

http://www.php.net/manual/en/refs.utilspec.image.php

Link to comment
Share on other sites

Find an implementation on the net in a language you understand and "translate" it into the language that you want to use. That's what I did a while back with a point-in-polygon algorithm:

 

http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html

 

It's important that when you "translate" between languages you carefully understand how both languages work and any assumptions the author made:

 

C Semantics

 

My code uses the fact that, in the C language, when executing the code a&&b, if a is false, then b must not be evaluated. If your compiler doesn't do this, then it's not implementing C, and you will get a divide-by-zero, i.a., when the test point is vertically in line with a vertical edge. When translating this code to another language with different semantics, then you must implement this test explicitly.

 

In this case it's the use of short-circuit logic.

 

Of course just "copying" between languages is not really challenging so read up on SIFT and how it works, take what you know and write test-cases (another class that will use your class, which doesn't have to exist at this point, and verifies the output), and start your implementation, extend your test-case as your knowledge about SIFT grows.

 

Example tests could be:

 

assertTrue(img.isSimilarTo(img)); // the same image is similar to itself
assertFalse(mydog.isSimilarTo(me)); // i am not my dog

Edited by ignace
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.