> while trying this code i got this error....can you tell me WHY ????? > > ??? Error using ==> times > Matrix dimensions must agree. > > > for ii = 1:length(thetas) > > b = P2(:,ii); > > this_correlation = abs(ifft(P1.*conj(b))); > > angle_scores(ii) = max(max(this_correlation)); > > end
Make sure that P1 is a column vector and P2 has the same number of rows as P1.
However, I've changed the way I solve this problem now. Two points to note for anybody stumbling on this:
1) What I said about only needing one radon projection for the reference might be true in theory, but I found in practice with noisy data that this was not so good. I've actually abandoned the radon approach.
2) I now solve my rotation problem in an entirely different way. I'm not sure how generally applicable this solution is, but it worked well for my application (very large images, only small angles of rotation possible, very precise estimate of rotation necessary).
I find the polar transforms of the reference and acquired images, and then do a typical registration between these using cross-correlation. The shift required in the theta dimension tells you the rotation required (the other dimension has radius info which I don't use). I got a Matlab function for creating a polar transform from this page:
This function lets you specify the sampling in both the theta and radial dimensions. I upsample quite a bit in the theta dimension (better precision on the angle estimate) and downsample in the radial dimension (to keep memory costs down - my images are quite large).