Code covered by the BSD License

### Highlights from 2D - 2D Projective Homography (3x3) Estimation

4.0

4.0 | 3 ratings Rate this file 57 Downloads (last 30 days) File Size: 14.3 KB File ID: #28760

# 2D - 2D Projective Homography (3x3) Estimation

19 Sep 2010 (Updated )

This function estimates 2D-2D projective homography between two images.

File Information
Description

This function estimates 2D-2D projective homography between two images using DLT, RANSAC and Lev-Mar optimisation.

The format for calling upon the function is as follows:

[h wim] = homography(im1, im2);

where

im1 -> 1st Image
im2 -> 2nd Image
h -> Returned homography matrix
wim -> Warped version of im1 w.r.t. im2

Acknowledgements

Open Surf (Including Image Warp) inspired this file.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.10 (R2010a)
26 Nov 2012

getting this error: Error using FastHessian_getResponse (line 2)
Not enough input arguments.

Error in FastHessian_BuildDerivative (line 4)
ds = (FastHessian_getResponse(t,r, c) - FastHessian_getResponse(b,r, c, t)) / 2;

for ds, there are only 3 arguments passed which throws an error, plz can anyone tell me urgently what can be the possible 4th argument to run this code successfully?
Any help will be highly appreciated..

14 Nov 2012

Can anyone please tell me if there any difference between the homest2d of this code and the Normalized NDLT (Hartley and Zisserman: Multiple View Geometry in Computer vision)?

13 Nov 2012

Hi Mr SasiKanth
I am needed to find estimation for the homography 2D that can relate a big number of points (100, 250...)
And i found this code is very interesting, especially the function homest2D

But if you may I have some question about homest2D:
1) Why you are using approximately the same approach of Fundamental Matrix? and what this can help?
2) if we have 2 sets of points, is homest2D enough to calculate the homography?
3) did you do any experimentation with homest2D? or any comparison with other algorithm, like Normalized DLT (Hartley and Zisserman: Multiple View Geometry in Computer vision)?
Thank you in advance for any help, and if you may have any document that explain each step of the algorithm, i will be very thankful
Thank you again

07 Feb 2012

@SasiKanth: thanks. The thing is that I think my images are affine-transformed rather than projective-transformed. I am working on Retinal OCT scans. Also, I used your build-in function to obtain the wim1 image, which is the transformed form of i1, but the registration with i2 doesn't look promising. I met the same situation when I tried SIFT algorithm. I guess it's because of the algorithm itself, if you by any chance have the similar experience, would you please offer me any knowledge? If not, thank you anyway, it's a great algorithm.

06 Feb 2012

@Hasheem: There is no specification to the king of image you need to use as feature matching takes place on gray images.

@Diogo: RandStream is a function in the newer versions of MATLAB. Why don't you replace it with the function that is present in the version you are using?

@Sean: You are referring to a function called 'imtransform' which transforms images based on a provided transformation matrix. Affine is only one case where as you said, the last column needs to be 0 0 1. however, you may even provide a full projective 3x3 matrix and pass the argument 'projective' to the function 'maketform'.

06 Feb 2012

Hi, I wonder how to apply the homography matrix h to the actually i1 or i2 in order to register them. MATLAB provides affine transformation while it requires the h to have [0;...;0;1] in the last column, which is not the case here. Thank you very much -Sean

26 May 2011

I could not find the function RandStream. Please, could you provide it so that I can run your code?

17 May 2011

I use gray-scale images as inputs. Is there any specification to what the inputs should be like?

16 May 2011

Hey Hashem,
That is the reason given by the MATLAB error minimization function for exiting the iterative algorithm. In case it is exiting in the very 1st loop itself, there is something wrong with the input you might be giving.

15 May 2011

i used this code just to run it
[h wim] = homography(im1, im2);

I get this error:
lsqcurvefit stopped because the size of the current step is less than
the default value of the step size tolerance.

24 Dec 2010

Which version of MATLAB do you use?

23 Dec 2010

??? Undefined function or method 'RandStream' for input arguments of type 'char'.

Error in ==> homography>autohomest2d at 61
stream = RandStream('mt19937ar','seed',sum(100*clock));

getting this error??????????????????

23 Dec 2010

??? Undefined function or method 'RandStream' for input arguments of type 'char'.

Error in ==> homography>autohomest2d at 61
stream = RandStream('mt19937ar','seed',sum(100*clock));

getting this error??????????????????

06 Dec 2010

An updated version of the file has been submitted with the ~'s replaced. It should be up soon.

06 Dec 2010

Hey,

The '~' is a feature in MATLAB 2010 where you need not specify a variable when you do not need it. You can replace all such instances with any arbitrary variable (say 'tmpx') and the code will run. Be careful not to replace wrong instances of '~' (such as in '~isNaN').

Hope this helps.

06 Dec 2010

What a pity, I fail to run the code.

06 Dec 2010
06 Dec 2010

[width, height, ~] = size(im1);

I want to know the meaning and role of '~' in the above command, who can tell me, please!