Re: my comment on 14 Jul 2010:
I owe an apology. It seems at the point when I wrote my comment I was feeding an accidentally reshaped array into the code. Because of the artifacts in my data, it caused a wrap around artifact in the output (and the registration worked in one axis only, but I didn't notice because that happened to be the axis containing almost all of the shifts).
Code registers images very well. Question about the supplementary output:
output = [error,diffphase,net_row_shift,net_col_shift]
On my data it seems that some times the row_shift variable seems to 'wrap around' in away that is not intuitive. For example though the data is only 512 pixels wide, I get row shifts of -512.3, 1024.3 etc which I assume are actually very small pixel shifts that have a somewhat random multiple of the image size thown on for fun.
Still really appreciate this code!!!! Had some problems importing a cluster containing metadata stored as properties with no large sets of data attached. I'd love to submit a TDMS file for you but am unsure how in this forum.
1. Program has a few instances of:
which get get called with these zero data property entries. and therefore eliminate the array that should exist
replacing them with
eliminates a failure at line 257, Index exceeds dimensions
and did not cause problems with rest of function.
2. Program assumed that there would be a lot of data attached and allocated a lot of memory to single value. I believe error had something to do with:
'estNumSeg=floor(filesize/(20+segLength)*1.2);' I hacked around this, making it equal to 1 for my special case, but surely there is correct method.
PS. Mathworks is currently posting the NI solution to this problem http://www.mathworks.com/support/solutions/en/data/1-2XFSRG/?solution=1-2XFSRG
Others may also wish to tell them how much better this solution is.
The code worked but I have some questions.
Why are the velocity arrays not of equal sizes as the image?
I used the images you included 252x316 and u and v where of 236x300.
While reconstuncting the image I(i,j) = Iold(i+u,j+v) the result wasn't very good. Have you tried reconstructing the image using only the first one and the velocity vectors? If so, can you provide the source ( just to check if my reconstructing code is bad written)?