radialcenter#

deeptrack.extras.radialcenter.radialcenter(I, invert_xy=False)#

Calculates the center of a 2D intensity distribution.

Considers lines passing through each half-pixel point with slope parallel to the gradient of the intensity at that point. Considers the distance of closest approach between these lines and the coordinate origin, and determines (analytically) the origin that minimizes the weighted sum of these distances-squared.

Parameters#

Inp.ndarray

2D intensity distribution (i.e. a grayscale image) Size need not be an odd number of pixels along each dimension

Returns#

float, float

Coordinate pair x, y of the center of radial symmetry, px, from px #1 = left/topmost pixel. So a shape centered in the middle of a 2*N+1 x 2*N+1 square (e.g. from make2Dgaussian.m with x0=y0=0) will return a center value at x0=y0=N+1.

Note that y increases with increasing row number (i.e. “downward”)