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
In the centroid function, there is a swap of the X and Y variables in both the input and output. Although the fragment "Centroid works on column major order" is present, it does not explicitly state that this function returns positions in the format [Y, X]. Especially considering that all code in centroid.m suggests it follows the convention [X, Y]. This change in convention also complicates swapping the centroid method with others, as other methods typically use the convention [X, Y], thus reducing the code's flexibility. To rectify this and provide clarity:
[w, h] = size(im); -> [h, w] = size(im);
Size returns length of dimensions in order Y, X, Z...
In the function outside of centroid in shwfs_make_fine_grid.m, there is a change:
dd = shstruct.centroid(subimage, level);
centres(i, :) = [cc(1)+dd(2)-1, cc(3)+dd(1)-1];
It is swap of x and y from dd. dd(1) = X and dd(2) = Y, so it is counterintuitive to add cc(1)+dd(2) (X+Y) and cc(2)+dd(1) (Y+X).
After changes in centroid.m it should be:
centres(i, :) = [cc(1)+dd(1)-1, cc(3)+dd(2)-1];
The text was updated successfully, but these errors were encountered:
Hi. I agree with you that centroid.m uses misleading names. But if its output is changed a lot of other functions should be double checked, not only shwfs_make_fine_grid.m. Possibly the plotting and estimation functions should be revised as well. Despite the wrong names within centroid.m, the code is correct. Currently, it estimates horizontal slopes as a horizontal Zernike tilt and it plots the displacements (quiver) in the right direction. I'll leave this open but currently I don't have time to prepare a thorough revision.
In the centroid function, there is a swap of the X and Y variables in both the input and output. Although the fragment "Centroid works on column major order" is present, it does not explicitly state that this function returns positions in the format [Y, X]. Especially considering that all code in centroid.m suggests it follows the convention [X, Y]. This change in convention also complicates swapping the centroid method with others, as other methods typically use the convention [X, Y], thus reducing the code's flexibility. To rectify this and provide clarity:
[w, h] = size(im); -> [h, w] = size(im);
Size returns length of dimensions in order Y, X, Z...
[yy, xx] = meshgrid(1:h, 1:w); -> [xx, yy] = meshgrid(1:w, 1:h);
Meshgrid input and output is [X,Y] = meshgrid(x,y)(https://se.mathworks.com/help/matlab/ref/meshgrid.html#d126e1020611)
In the function outside of centroid in shwfs_make_fine_grid.m, there is a change:
dd = shstruct.centroid(subimage, level);
centres(i, :) = [cc(1)+dd(2)-1, cc(3)+dd(1)-1];
It is swap of x and y from dd. dd(1) = X and dd(2) = Y, so it is counterintuitive to add cc(1)+dd(2) (X+Y) and cc(2)+dd(1) (Y+X).
After changes in centroid.m it should be:
centres(i, :) = [cc(1)+dd(1)-1, cc(3)+dd(2)-1];
The text was updated successfully, but these errors were encountered: