This is the translation of the OpenSURF Computer Vision library from Chris Evans to RealBasic, plus I’ve added some code to compare two pictures. The conversion to RealBasic is not as fast as the C# or C++ version. In fact it is rather slow, but you can use it for educational purposes. If by any chance you’re one of these guys who want to spend some time speeding up this code, please let me know because it can benefit a lot of programmers out there.
SURF (Speeded Up Robust Feature) is a robust local feature detector, first presented by Herbert Bay et al. in 2006, that can be used in computer vision tasks like object recognition or 3D reconstruction.
Christopher Evans on the OpenSURF library:
The task of finding point correspondences between two images of the same scene or object is an integral part of many machine vision or computer vision systems. The algorithm aims to find salient regions in images which can be found under a variety of image transformations. This allows it to form the basis of many vision based tasks; object recognition, video surveillance, medical imaging, augmented reality and image retrieval to name a few.
The concept of feature detection refers to methods to find edges, corners, blobs etc within images that can be used to detect, identify and compare images and is robust against different image transformations like roations, skews, etc…
The code is to complicated to put in this article. The engine is here so you can use it without worrying about the complicated maths. The class has an easy-to-use interface and you can start new Computer Vision experiments with your favorite computer language! 🙂
In fact, this is the only code you need to use it:
' declare an opensurf and run it on the first image OSurf1 = new ABOpenSURF OSurf1.ExecuteSURF(Image1,1,true) ' declare a second opensurf and run it on the second image OSurf2 = new ABOpenSURF OSurf2.ExecuteSURF(Image2, 1, true) ' get the matching points between the two images OSurf2.GetMatchingPoints(OSurf1) ' and draw them OSurf1.PaintSURF(mBuffer1, DebugMode, true) OSurf2.PaintSURF(mBuffer2, DebugMode, true) Canvas1.Refresh(true) Canvas2.Refresh(true)
Guess it can’t get any simpler to do such a complicated task 🙂
Note 1: An application of the SURF algorithm is patented in the US!
Note 2: In the next article I’ll give you the Realbasic translation of the FAST (Features from Accelerated Segment Test) engine!
The RealBasic implementation of OpenSURF: http://www.gorgeousapps.com/ABopenSURF.zip
Also check out the official OpenSURF library in C++/C#: http://www.chrisevansdev.com/computer-vision-opensurf.html