Okay, here we are in MATLAB and I've already loaded two images into my workspace. I can display these two. I put them both into a cell array and the artist's function will display them next to each other as we can see here.
The two images here are clearly taken from a different viewpoints. Now what I'm going to do is to compute the interest points, the feature points, the distinctive points in each of these images that we're likely to be able to match between one image and another. Now there are a whole lot of different sorts of feature detectors that have been created by computer vision researchers over the years. The particular detector that we're going to use here is called the surf detector and I invoke that using the function isurf and I pass in the image. And here's the result. The surf detector has found 2,667 interesting or unique corner features within the scene. Points that are likely to be able to be located in another image of that same scene, but taken from a different view point.
Let's have a look at the points that is found. What I'm going to do is to display the image again. There it is there. And I'm just going to make it appear a little bit dark using the colour map menu bar. The workspace variable F1 is a vector of surf point feature object. It's a vector that's 2,667 long and these features are ordered from the most distinctive feature to the least distinctive feature. So what I'm going to do is to take the first 200 elements. These are 200 strongest features and I'm going to plot them and I'm going to plot them as white diamonds. And here we can see the distinctive features that the surf algorithm has detected. A number of them associated with very obvious features in the trees but a number of them were attached to distinctive features on the building. The corners of balconies and other sharp edges on that building.
What we are going to do now is to compute the surf features for the other image. I do it in a very similar way. Takes a moment to compute. And this time it's found 2,448 corner features in image number 2. Now some of the features found in image number 1 are going to match features that are found in image number 2. And we can find those matching features, the corresponding features by using the match method of the feature object.
So what this does is to match all the features in the vector F2 with all features in the vector F1 and return a match object and the match object, I can display its value here, indicates that there are 841 corresponding points. So there is 2,000 odd corner features in one image, 2,000 odd corner features this in the second image. The matching process is found 841 that are believes are corresponding pairs.
Now in is another object and one of it's methods is P. I'm going to scroll up to the top of this rather large display here. We can see that all of these numbers are multiplied by 1,000.
So what is this saying it's that the point at coordinate 1,007 and 354. It matches the point where the coordinate 791 and 383 in the second image. So this matrix, each corner that represents a pair of corresponding coordinates across the two images.
Now, this is rather difficult to interpret. So what I'm going to do is to display again the two images. Image 1 and image 2 next to each other and there we have it. And once again, I'm going to make that a little bit darker. And now what I'm going to do is to plot a subset of all these matches. I don't want all of them. I'll take a hundred strongest matches between the two images and that's another match object and now I'm going to plot that with white lines. So what I'm going to do is to plot white lines or join the 100 strongest features between image 1 and image 2. Now not all these matches will be perfect but if we look at some of the lines, we can see that they very clearly join corresponding features in the two images.
We use MATLAB and some Toolbox functions to find corresponding points between two images using SURF features.
This content assumes an understanding of high school level mathematics; for example, trigonometry, algebra, calculus, physics (optics) and experience with MATLAB command line and programming, for example workspace, variables, arrays, types, functions and classes.