def elliptic_fourier_descriptors(contour, order=<NUM_LIT:10>, normalize=False):
dxy = np.diff(contour, axis=<NUM_LIT:0>)<EOL>dt = np.sqrt((dxy ** <NUM_LIT:2>).sum(axis=<NUM_LIT:1>))<EOL>t = np.concatenate([([<NUM_LIT:0.>, ]), np.cumsum(dt)])<EOL>T = t[-<NUM_LIT:1>]<EOL>phi = (<NUM_LIT:2> * np.pi * t) / T<EOL>coeffs = np.zeros((order, <NUM_LIT:4>))<EOL>for n in _range(<NUM_LIT:1>, order + <NUM_LIT:1>):<EOL><INDENT>const = T / (<NUM_LIT:2> * n * n * np.pi * np.pi)<EOL>phi_n = phi * n<EOL>d_cos_phi_n = np.cos(phi_n[<NUM_LIT:1>:]) - np.cos(phi_n[:-<NUM_LIT:1>])<EOL>d_sin_phi_n = np.sin(phi_n[<NUM_LIT:1>:]) - np.sin(phi_n[:-<NUM_LIT:1>])<EOL>a_n = const * np.sum((dxy[:, <NUM_LIT:0>] / dt) * d_cos_phi_n)<EOL>b_n = const * np.sum((dxy[:, <NUM_LIT:0>] / dt) * d_sin_phi_n)<EOL>c_n = const * np.sum((dxy[:, <NUM_LIT:1>] / dt) * d_cos_phi_n)<EOL>d_n = const * np.sum((dxy[:, <NUM_LIT:1>] / dt) * d_sin_phi_n)<EOL>coeffs[n - <NUM_LIT:1>, :] = a_n, b_n, c_n, d_n<EOL><DEDENT>if normalize:<EOL><INDENT>coeffs = normalize_efd(coeffs)<EOL><DEDENT>return coeffs<EOL>
Calculate elliptical Fourier descriptors for a contour.

    :param numpy.ndarray contour: A contour array of size ``[M x 2]``.
    :param int order: The order of Fourier coefficients to calculate.
    :param bool normalize: If the coefficients should be normalized;
        see references for details.
    :return: A ``[order x 4]`` array of Fourier coefficients.
    :rtype: :py:class:`numpy.ndarray`