Zernike polynomials



In mathematics, the Zernike polynomials are a sequence of polynomials that are orthogonal on the unit disk. Named after optical physicist Frits Zernike, laureate of the 1953 Nobel Prize in Physics and the inventor of phase-contrast microscopy, they play important roles in various optics branches such as beam optics and imaging.

Definitions
There are even and odd Zernike polynomials. The even Zernike polynomials are defined as


 * $$Z^{m}_n(\rho,\varphi) = R^m_n(\rho)\,\cos(m\,\varphi) \!$$

(even function over the azimuthal angle $$\varphi$$), and the odd Zernike polynomials are defined as


 * $$Z^{-m}_n(\rho,\varphi) = R^m_n(\rho)\,\sin(m\,\varphi), \!$$

(odd function over the azimuthal angle $$\varphi$$) where m and n are nonnegative integers with n ≥ m ≥ 0 (m = 0 for spherical Zernike polynomials), $$\varphi$$ is the azimuthal angle, ρ is the radial distance $$0\le\rho\le 1$$, and $$R^m_n$$ are the radial polynomials defined below. Zernike polynomials have the property of being limited to a range of −1 to +1, i.e. $$|Z^{m}_n(\rho,\varphi)| \le 1$$. The radial polynomials $$R^m_n$$ are defined as


 * $$R^m_n(\rho) = \sum_{k=0}^{\tfrac{n-m}{2}} \frac{(-1)^k\,(n-k)!}{k!\left (\tfrac{n+m}{2}-k \right )! \left (\tfrac{n-m}{2}-k \right)!} \;\rho^{n-2k}$$

for an even number of n − m, while it is 0 for an odd number of n − m. A special value is


 * $$R_n^m(1)=1. $$

Other representations
Rewriting the ratios of factorials in the radial part as products of binomials shows that the coefficients are integer numbers:


 * $$R_n^m(\rho)=\sum_{k=0}^{\tfrac{n-m}{2}}(-1)^k \binom{n-k}{k} \binom{n-2k}{\tfrac{n-m}{2}-k} \rho^{n-2k}$$.

A notation as terminating Gaussian hypergeometric functions is useful to reveal recurrences, to demonstrate that they are special cases of Jacobi polynomials, to write down the differential equations, etc.:


 * $$\begin{align}

R_n^m(\rho) &= (-1)^{(n-m)/2} \rho^mP_{(n-m)/2}^{(m,0)}(1-2\rho^2) \\ &= \binom{n}{\tfrac{n+m}{2}}\rho^n \ {}_2F_{1}\left(-\tfrac{n+m}{2},-\tfrac{n-m}{2};-n;\rho^{-2}\right) \\ &= (-1)^{\tfrac{n-m}{2}}\binom{\tfrac{n+m}{2}}{m}\rho^m \ {}_2F_{1}\left(1+\tfrac{n+m}{2},-\tfrac{n-m}{2};1+m;\rho^2\right) \end{align}$$

for n − m even.

The inverse relation expands $$\rho ^j$$ for fixed $$m\le j$$ into $$R_n^m(\rho)$$

\rho^j = \sum_{n\equiv m \pmod 2}^j h_{j,n,m}R_n^m(\rho) $$ with rational coefficients $$h_{j,n,m}$$

h_{j,n,m}= \frac{n+1}{1+\frac{j+n}{2}} \frac{\binom{(j-m)/2}{(n-m)/2}}{\binom{(j+n)/2}{(n-m)/2}} $$ for even $$j-m=0,2,4,\ldots$$.

The factor $$\rho^{n-2k}$$ in the radial polynomial $$R_n^m(\rho)$$ may be expanded in a Bernstein basis of $$b_{s,n/2}(\rho^2)$$ for even $$n$$ or $$\rho$$ times a function of $$b_{s,(n-1)/2}(\rho^2)$$ for odd $$n$$ in the range $$\lfloor n/2\rfloor-k \le s \le \lfloor n/2\rfloor$$. The radial polynomial may therefore be expressed by a finite number of Bernstein Polynomials with rational coefficients:
 * $$R_n^m(\rho) = \frac{1}{\binom{\lfloor n/2\rfloor}{\lfloor m/2\rfloor}} \rho^{n\mod 2} \sum_{s=\lfloor m/2\rfloor}^{\lfloor n/2\rfloor} (-1)^{\lfloor n/2\rfloor -s} \binom{s}{\lfloor m/2\rfloor}\binom{(n+m)/2}{s+\lceil m/2\rceil} b_{s,\lfloor n/2\rfloor}(\rho^2).$$

Noll's sequential indices
Applications often involve linear algebra, where an integral over a product of Zernike polynomials and some other factor builds a matrix elements. To enumerate the rows and columns of these matrices by a single index, a conventional mapping of the two indices n and l to a single index j has been introduced by Noll. The table of this association $$Z_n^l \rightarrow Z_j$$ starts as follows. $$ j = \frac{n(n+1)}{2}+|l|+\left\{\begin{array}{ll} 0, & l>0 \land n \equiv \{0,1\} \pmod 4;\\ 0, & l<0 \land n \equiv \{2,3\} \pmod 4;\\ 1, & l \ge 0 \land n \equiv \{2,3\} \pmod 4;\\ 1, & l \le 0 \land n \equiv \{0,1\} \pmod 4. \end{array}\right. $$ The rule is the following.


 * The even Zernike polynomials Z (with even azimuthal parts $$\cos(m\varphi)$$, where $$m=l$$ as $$l$$ is a positive number) obtain even indices j.
 * The odd Z obtains (with odd azimuthal parts $$\sin(m\varphi)$$, where $$m=\left\vert l \right\vert$$ as $$l$$ is a negative number) odd indices j.
 * Within a given n, a lower $$\left\vert l \right\vert$$ results in a lower j.

OSA/ANSI standard indices
OSA and ANSI single-index Zernike polynomials using:


 * $$j =\frac{n(n+2)+l}{2}$$

Fringe/University of Arizona indices
The Fringe indexing scheme is used in commercial optical design software and optical testing in, e.g., photolithography.

$$ j = \left(1+\frac{n+|l|}{2}\right)^2-2|l|+ \frac{1-\sgn l}{2} $$

where $$ \sgn l $$ is the sign or signum function. The first 20 fringe numbers are listed below.

Wyant indices
James C. Wyant uses the "Fringe" indexing scheme except it starts at 0 instead of 1 (subtract 1). This method is commonly used including interferogram analysis software in Zygo interferometers and the open source software DFTFringe.

Rodrigues Formula
They satisfy the Rodrigues' formula
 * $$Z_{n}^{m}(x)=\frac{x^{-m}}{\left( \frac{n-m}{2} \right) !}\left( \frac{d}{d\left( x^2 \right)} \right) ^{\frac{n-m}{2}}\left[ x^{n+m}\left( x^2-1 \right) ^{\frac{n-m}{2}} \right]$$

and can be related to the Jacobi polynomials as
 * $$Z_{n}^{m}(x)=x^m\frac{P_{\frac{n-m}{2}}^{(0,m)}\left( 2x^2-1 \right)}{P_{\frac{n-m}{2}}^{(0,m)}(1)}$$.

Orthogonality
The orthogonality in the radial part reads
 * $$\int_0^1\sqrt{2n+2}R_n^m(\rho)\,\sqrt{2n'+2}R_{n'}^{m}(\rho)\,\rho d\rho = \delta_{n,n'}$$

or

$$ \underset{0}{\overset{1}{\mathop \int }}\,R_{n}^{m}(\rho )R_^{m}(\rho )\rho d\rho =\frac{2n+2}. $$

Orthogonality in the angular part is represented by the elementary


 * $$\int_0^{2\pi} \cos(m\varphi)\cos(m'\varphi)\,d\varphi=\epsilon_m\pi\delta_{m,m'},$$
 * $$\int_0^{2\pi} \sin(m\varphi)\sin(m'\varphi)\,d\varphi=\pi\delta_{m,m'};\quad m\neq 0,$$
 * $$\int_0^{2\pi} \cos(m\varphi)\sin(m'\varphi)\,d\varphi=0,$$

where $$\epsilon_m$$ (sometimes called the Neumann factor because it frequently appears in conjunction with Bessel functions) is defined as 2 if $$m=0$$ and 1 if $$m\neq 0$$. The product of the angular and radial parts establishes the orthogonality of the Zernike functions with respect to both indices if integrated over the unit disk,


 * $$\int Z_n^l(\rho,\varphi)Z_{n'}^{l'}(\rho,\varphi) \, d^2r =\frac{\epsilon_l\pi}{2n+2}\delta_{n,n'}\delta_{l,l'},$$

where $$d^2r=\rho\,d\rho\,d\varphi$$ is the Jacobian of the circular coordinate system, and where $$n-l$$ and $$n'-l'$$ are both even.

Zernike transform
Any sufficiently smooth real-valued phase field over the unit disk $$G(\rho,\varphi)$$ can be represented in terms of its Zernike coefficients (odd and even), just as periodic functions find an orthogonal representation with the Fourier series. We have
 * $$G(\rho,\varphi) = \sum_{m,n}\left[ a_{m,n} Z^{m}_n(\rho,\varphi) + b_{m,n} Z^{-m}_n(\rho,\varphi) \right],$$

where the coefficients can be calculated using inner products. On the space of $$L^2$$ functions on the unit disk, there is an inner product defined by
 * $$\langle F, G \rangle := \int F(\rho,\varphi)G(\rho,\varphi)\rho d\rho d\varphi.$$

The Zernike coefficients can then be expressed as follows:


 * $$\begin{align}

a_{m,n} &= \frac{2n+2}{\epsilon_m\pi} \left \langle G(\rho,\varphi),Z^{m}_n(\rho,\varphi) \right \rangle, \\ b_{m,n} &= \frac{2n+2}{\epsilon_m\pi} \left \langle G(\rho,\varphi),Z^{-m}_n(\rho,\varphi) \right \rangle. \end{align}$$

Alternatively, one can use the known values of phase function G on the circular grid to form a system of equations. The phase function is retrieved by the unknown-coefficient weighted product with (known values) of Zernike polynomial across the unit grid. Hence, coefficients can also be found by solving a linear system, for instance by matrix inversion. Fast algorithms to calculate the forward and inverse Zernike transform use symmetry properties of trigonometric functions, separability of radial and azimuthal parts of Zernike polynomials, and their rotational symmetries.

Symmetries
The reflections of trigonometric functions result that the parity with respect to reflection along the x axis is
 * $$Z_n^{l}(\rho,\varphi)=Z_n^{l}(\rho,-\varphi)$$ for l ≥ 0,
 * $$Z_n^{l}(\rho,\varphi)=-Z_n^{l}(\rho,-\varphi)$$ for l < 0.

The π shifts of trigonometric functions result that the parity with respect to point reflection at the center of coordinates is
 * $$Z_n^l(\rho,\varphi) = (-1)^l Z_n^l(\rho,\varphi+\pi),$$

where $$(-1)^l$$ could as well be written $$(-1)^n$$ because $$n-l$$ as even numbers are only cases to get non-vanishing Zernike polynomials. (If n is even then l is also even. If n is odd, then l is also odd.) This property is sometimes used to categorize Zernike polynomials into even and odd polynomials in terms of their angular dependence. (it is also possible to add another category with l = 0 since it has a special property of no angular dependence.)


 * Angularly even Zernike polynomials: Zernike polynomials with even l so that $$Z_n^l(\rho,\varphi) = Z_n^l(\rho,\varphi+\pi).$$
 * Angularly odd Zernike polynomials: Zernike polynomials with odd l so that $$Z_n^l(\rho,\varphi) = - Z_n^l(\rho,\varphi+\pi).$$

The radial polynomials are also either even or odd, depending on order n or m:


 * $$R_n^m(\rho)=(-1)^n R_n^m(-\rho)=(-1)^m R_n^m(-\rho).$$

These equalities are easily seen since $$R_n^m(\rho)$$ with an odd (even) m contains only odd (even) powers to ρ (see examples of $$R_n^m(\rho)$$ below).

The periodicity of the trigonometric functions results in invariance if rotated by multiples of $$2\pi/l$$ radian around the center:


 * $$Z_n^l \left (\rho, \varphi+ \tfrac{2\pi k}{l} \right )=Z_n^l(\rho,\varphi),\qquad k= 0, \pm 1,\pm 2,\cdots.$$

Recurrence relations
The Zernike polynomials satisfy the following recurrence relation which depends neither on the degree nor on the azimuthal order of the radial polynomials:


 * $$\begin{align}

R_n^m(\rho)+R_{n-2}^m(\rho)=\rho\left[R_{n-1}^{\left|m-1\right|}(\rho)+R_{n-1}^{m+1}(\rho)\right] \text{ .} \end{align}$$

From the definition of $$R_n^m$$ it can be seen that $$R_m^m(\rho) = \rho^m$$ and $$R_{m+2}^m(\rho) = ((m+2)\rho^{2} - (m+1))\rho^m$$. The following three-term recurrence relation then allows to calculate all other $$R_n^m(\rho)$$:



R_n^m(\rho) = \frac{2(n-1)(2n(n-2)\rho^2-m^2-n(n-2))R_{n-2}^m(\rho) - n(n+m-2)(n-m-2)R_{n-4}^m(\rho)}{(n+m)(n-m)(n-2)} \text{ .} $$

The above relation is especially useful since the derivative of $$R_n^m$$ can be calculated from two radial Zernike polynomials of adjacent degree:



\frac{\operatorname{d}}{\operatorname{d}\! \rho} R_n^m(\rho) = \frac{(2 n m (\rho^2 - 1) + (n-m)(m + n(2\rho^2 - 1))) R_n^m(\rho) - (n+m)(n-m) R_{n-2}^m(\rho)}{2 n \rho (\rho^2 - 1)} \text{ .} $$

The differential equation of the Gaussian Hypergeometric Function is equivalent to

\rho^2(\rho^2-1) \frac{d^2}{d\rho^2} R_n^m(\rho) = [n(n+2)\rho^2-m^2]R_n^m(\rho)+\rho(1-3\rho^2)\frac{d}{d\rho} R_n^m(\rho). $$

Radial polynomials
The first few radial polynomials are:


 * $$ R^0_0(\rho) = 1 \,$$


 * $$ R^1_1(\rho) = \rho \,$$


 * $$ R^0_2(\rho) = 2\rho^2 - 1 \,$$


 * $$ R^2_2(\rho) = \rho^2 \,$$


 * $$ R^1_3(\rho) = 3\rho^3 - 2\rho \, $$


 * $$ R^3_3(\rho) = \rho^3 \,$$


 * $$ R^0_4(\rho) = 6\rho^4 - 6\rho^2 + 1 \,$$


 * $$ R^2_4(\rho) = 4\rho^4 - 3\rho^2 \,$$


 * $$ R^4_4(\rho) = \rho^4 \,$$


 * $$ R^1_5(\rho) = 10\rho^5 - 12\rho^3 + 3\rho \,$$


 * $$ R^3_5(\rho) = 5\rho^5 - 4\rho^3 \,$$


 * $$ R^5_5(\rho) = \rho^5 \,$$


 * $$ R^0_6(\rho) = 20\rho^6 - 30\rho^4 + 12\rho^2 - 1 \,$$


 * $$ R^2_6(\rho) = 15\rho^6 - 20\rho^4 + 6\rho^2 \,$$


 * $$ R^4_6(\rho) = 6\rho^6 - 5\rho^4 \,$$


 * $$ R^6_6(\rho) = \rho^6. \,$$

Zernike polynomials
The first few Zernike modes, at various indices, are shown below. They are normalized such that: $$\int_0^{2\pi} \int_0^1 Z^2\cdot\rho\,d\rho\,d\phi = \pi$$, which is equivalent to $$ \operatorname{Var}(Z)_\text{unit circle} = 1 $$.

Applications


The functions are a basis defined over the circular support area, typically the pupil planes in classical optical imaging at visible and infrared wavelengths through systems of lenses and mirrors of finite diameter. Their advantages are the simple analytical properties inherited from the simplicity of the radial functions and the factorization in radial and azimuthal functions; this leads, for example, to closed-form expressions of the two-dimensional Fourier transform in terms of Bessel functions. Their disadvantage, in particular if high n are involved, is the unequal distribution of nodal lines over the unit disk, which introduces ringing effects near the perimeter $$\rho\approx 1$$, which often leads attempts to define other orthogonal functions over the circular disk.

In precision optical manufacturing, Zernike polynomials are used to characterize higher-order errors observed in interferometric analyses. In wavefront slope sensors like the Shack-Hartmann, Zernike coefficients of the wavefront can be obtained by fitting measured slopes with Zernike polynomial derivatives averaged over the sampling subapertures. In optometry and ophthalmology, Zernike polynomials are used to describe wavefront aberrations of the cornea or lens from an ideal spherical shape, which result in refraction errors. They are also commonly used in adaptive optics, where they can be used to characterize atmospheric distortion. Obvious applications for this are IR or visual astronomy and satellite imagery.

Another application of the Zernike polynomials is found in the Extended Nijboer–Zernike theory of diffraction and aberrations.

Zernike polynomials are widely used as basis functions of image moments. Since Zernike polynomials are orthogonal to each other, Zernike moments can represent properties of an image with no redundancy or overlap of information between the moments. Although Zernike moments are significantly dependent on the scaling and the translation of the object in a region of interest (ROI), their magnitudes are independent of the rotation angle of the object. Thus, they can be utilized to extract features from images that describe the shape characteristics of an object. For instance, Zernike moments are utilized as shape descriptors to classify benign and malignant breast masses or the surface of vibrating disks. Zernike Moments also have been used to quantify shape of osteosarcoma cancer cell lines in single cell level. Moreover, Zernike Moments have been used for early detection of Alzheimer's disease by extracting discriminative information from the MR images of Alzheimer's disease, Mild cognitive impairment, and Healthy groups.

Higher dimensions
The concept translates to higher dimensions D if multinomials $$x_1^ix_2^j\cdots x_D^k$$ in Cartesian coordinates are converted to hyperspherical coordinates, $$\rho^s, s\le D$$, multiplied by a product of Jacobi polynomials of the angular variables. In $$D=3$$ dimensions, the angular variables are spherical harmonics, for example. Linear combinations of the powers $$\rho^s$$ define an orthogonal basis $$R_n^{(l)}(\rho)$$ satisfying


 * $$\int_0^1 \rho^{D-1}R_n^{(l)}(\rho)R_{n'}^{(l)}(\rho)d\rho = \delta_{n,n'}$$.

(Note that a factor $$\sqrt{2n+D}$$ is absorbed in the definition of R here, whereas in $$D=2$$ the normalization is chosen slightly differently. This is largely a matter of taste, depending on whether one wishes to maintain an integer set of coefficients or prefers tighter formulas if the orthogonalization is involved.) The explicit representation is


 * $$\begin{align}

R_n^{(l)}(\rho) &= \sqrt{2n+D}\sum_{s=0}^{\tfrac{n-l}{2}} (-1)^s {\tfrac{n-l}{2} \choose s}{n-s-1+\tfrac{D}{2} \choose \tfrac{n-l}{2}}\rho^{n-2s} \\ &=(-1)^{\tfrac{n-l}{2}} \sqrt{2n+D} \sum_{s=0}^{\tfrac{n-l}{2}} (-1)^s {\tfrac{n-l}{2} \choose s} {s-1+\tfrac{n+l+D}{2} \choose \tfrac{n-l}{2}} \rho^{2s+l} \\ &=(-1)^{\tfrac{n-l}{2}} \sqrt{2n+D} {\tfrac{n+l+D}{2}-1 \choose \tfrac{n-l}{2}} \rho^l \ {}_2F_1 \left ( -\tfrac{n-l}{2},\tfrac{n+l+D}{2}; l+\tfrac{D}{2}; \rho^2 \right ) \end{align}$$

for even $$n-l\ge 0$$, else identical to zero.