Centroid

Notes:

Calculate the centroid and slopes for all apertures:
The structure of the return on the function is a row vector of slopes:
[s_x(0,0),.,s_x(0,N),.,s_x(M,0),.,s_x(M,N),s_y(0,0),.,s_y(0,N),.,s_y(M,0),.,s_y(M,N)]

Centroid calculation using thresholding method.

The output of centroid function is actually the slopevector, because that's what WFR needs.
I create that centroidvector just to see if the centroid obtained is as expected or not, since it is easier to see the the centroid and compare to ideal spot rather than slope which has no reference to compare. I will delete the centroidvector.