You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've gotten a lot of mileage from the matlab code, and I was delighted to see it was ported to python. Thanks!
I'm a bit new to python still and I'm not up for a fork/pull request (or whatever the right term is) at this moment. But I thought I'd share what I believe to be a bug in register_images
im1 and im2 are both arrays of shape (1, 26021)
if I execute dx,dy = image_registration.register_images(im1,im2,usfac=4,maxoff=150)
then I get an error:
CClarge[round(mlarge/4.):round(mlarge/4.*3),round(nlarge/4.):round(nlarge/4.*3)] = fftshift(buf1ft) * conj(fftshift(buf2ft));
ValueError: could not broadcast input array from shape (1,26021) into shape (2,26022)
If I use input arrays of size (1, 26022) (i.e. even number) instead then it works beautifully.
I am guessing that the change from matlab's fix to pythons round is the issue.
I changed that line to: CClarge[int(m-np.fix(m/2)):int(m+np.fix((m-1)/2)+1),int(n-np.fix(n/2)):int(n+np.fix((n-1)/2)+1)] = fftshift(buf1ft) * conj(fftshift(buf2ft));
And it worked without error. Though I have not assessed if that change introduces any errors in the algorithm.
The text was updated successfully, but these errors were encountered:
I've gotten a lot of mileage from the matlab code, and I was delighted to see it was ported to python. Thanks!
I'm a bit new to python still and I'm not up for a fork/pull request (or whatever the right term is) at this moment. But I thought I'd share what I believe to be a bug in
register_images
im1
andim2
are both arrays of shape(1, 26021)
if I execute
dx,dy = image_registration.register_images(im1,im2,usfac=4,maxoff=150)
then I get an error:
If I use input arrays of size
(1, 26022)
(i.e. even number) instead then it works beautifully.I am guessing that the change from matlab's
fix
to pythonsround
is the issue.I changed that line to:
CClarge[int(m-np.fix(m/2)):int(m+np.fix((m-1)/2)+1),int(n-np.fix(n/2)):int(n+np.fix((n-1)/2)+1)] = fftshift(buf1ft) * conj(fftshift(buf2ft));
And it worked without error. Though I have not assessed if that change introduces any errors in the algorithm.
The text was updated successfully, but these errors were encountered: