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.

General tip: when adding references in a sentence "bla bla bla said that this works~\cite{...}" use the tilde to make sure that the word "works" and the reference are not put in different lines. The same goes for any kind of equation referencing or text referencing.