TheNavigator Posted October 6, 2012 Share Posted October 6, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/269162-sift-on-a-server/ Share on other sites More sharing options...
berridgeab Posted October 6, 2012 Share Posted October 6, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/269162-sift-on-a-server/#findComment-1383229 Share on other sites More sharing options...
TheNavigator Posted October 6, 2012 Author Share Posted October 6, 2012 It's not a must of course to code than in php. C# would be better, but the point would be, how to run that on a CentOS server? Quote Link to comment https://forums.phpfreaks.com/topic/269162-sift-on-a-server/#findComment-1383253 Share on other sites More sharing options...
kicken Posted October 6, 2012 Share Posted October 6, 2012 C# would be better, but the point would be, how to run that on a CentOS server? Via the Mono Project Quote Link to comment https://forums.phpfreaks.com/topic/269162-sift-on-a-server/#findComment-1383312 Share on other sites More sharing options...
TheNavigator Posted October 6, 2012 Author Share Posted October 6, 2012 Okay, so now, how to implement SIFT in C#?.... Quote Link to comment https://forums.phpfreaks.com/topic/269162-sift-on-a-server/#findComment-1383378 Share on other sites More sharing options...
ignace Posted October 7, 2012 Share Posted October 7, 2012 (edited) 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 October 7, 2012 by ignace Quote Link to comment https://forums.phpfreaks.com/topic/269162-sift-on-a-server/#findComment-1383430 Share on other sites More sharing options...
TheNavigator Posted October 7, 2012 Author Share Posted October 7, 2012 That was an awesome post, but I don't know how to find an implementation of such algorithm. Can someone help? I'll search too. If I found it I'll link it here for others who want to do the same, you know Quote Link to comment https://forums.phpfreaks.com/topic/269162-sift-on-a-server/#findComment-1383504 Share on other sites More sharing options...
TheNavigator Posted October 7, 2012 Author Share Posted October 7, 2012 Okay, so I found this. http://www.vlfeat.org/~vedaldi/code/siftpp.html The files were uploaded 7 days ago. Thanks God about that. Anyway, I still can't understand how can I convert this to something that outputs matching percentage of 2 drawn graphic images, which is what I actually need to do. Quote Link to comment https://forums.phpfreaks.com/topic/269162-sift-on-a-server/#findComment-1383506 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.