Spherical Harmonics

From David's Wiki
\( \newcommand{\P}[]{\unicode{xB6}} \newcommand{\AA}[]{\unicode{x212B}} \newcommand{\empty}[]{\emptyset} \newcommand{\O}[]{\emptyset} \newcommand{\Alpha}[]{Α} \newcommand{\Beta}[]{Β} \newcommand{\Epsilon}[]{Ε} \newcommand{\Iota}[]{Ι} \newcommand{\Kappa}[]{Κ} \newcommand{\Rho}[]{Ρ} \newcommand{\Tau}[]{Τ} \newcommand{\Zeta}[]{Ζ} \newcommand{\Mu}[]{\unicode{x039C}} \newcommand{\Chi}[]{Χ} \newcommand{\Eta}[]{\unicode{x0397}} \newcommand{\Nu}[]{\unicode{x039D}} \newcommand{\Omicron}[]{\unicode{x039F}} \DeclareMathOperator{\sgn}{sgn} \def\oiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x222F}\,}{\unicode{x222F}}{\unicode{x222F}}{\unicode{x222F}}}\,}\nolimits} \def\oiiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x2230}\,}{\unicode{x2230}}{\unicode{x2230}}{\unicode{x2230}}}\,}\nolimits} \)

Spherical Harmonics are a set of orthonormal basis functions defined over a sphere.
\(\displaystyle f: (\phi, \theta) \rightarrow f(\phi, \theta) \in \mathbb{R}\)

Background

Harmonic Function

A function \(\displaystyle f: \mathbb{R}^n \rightarrow \mathbb{R}\) is a harmonic function if it satisfies Laplace's equation:

  • The Laplacian (or trace of the hessian) is zero.
  • \(\displaystyle \Delta f = \frac{\partial^2f}{\partial x_1^2} + \frac{\partial^2f}{\partial x_2^2} + \cdots + \frac{\partial^2f}{\partial x_n^2} = 0\)

Associated Legendre Polynomials

Associated Legendre Polynomials are a set of orthogonal polynomials defined over \([-1, 1]\).
Each is represented as \(P^m_l\) where \(0 \leq m \leq l\).
I.e.
\(P^0_0(x)\)
\(P^0_1(x), P^1_1(x)\)
\(P^0_2(x), P^1_2(x),p^2_2(x)\)

The following 3 recurrance relations define the associated legendre polynomials:

  1. \(\displaystyle (l-m)P_l^m = x(2l-1)P_{l-1}^m - (l+1-1) P_{l-2}^m\)
  2. \(\displaystyle P_m^m = (-1)^m(2m-1)!! (1-x^2)^{m/2}\)
  3. \(\displaystyle P^m_{m+1} = x(2m+1)P^m_m\)

Notes:

  • Here \(\displaystyle (x)!! = \begin{cases} (x)*(x-2)*...*(1) & x\text{ odd}\\ (x)*(x-2)*...*(2) & x\text{ even} \end{cases} \)

Definition

Spherical Harmonics are a set of orthonormal basis functions defined on the sphere.
Below are some explicit formulas for Laplace spherical harmonics stolen from [1]
There are \(\displaystyle 2l+1\) functions for each band.

  • \(\displaystyle Y_l^m(\theta, \varphi) = K_l^m e^{i m \varphi} P_l^{|m|} \cos(\theta)\) for \(\displaystyle -l \leq m \leq l\)
where \(\displaystyle P_l^m\) are the associated Legendre Polynomials
and \(\displaystyle K_l^m = \sqrt{\frac{(2l+1)(l-|m|)!}{4 \pi (l+|m|)!}}\)
l is the band, m is the function

For a real valued basis,

  • \(\displaystyle y_l^m = \begin{cases} \sqrt{2}\operatorname{Re}(Y_l^m) & m \gt 0\\ \sqrt{2}\operatorname{Im}(Y_l^m) & m \lt 0\\ Y_l^0 & m = 0 \end{cases} = \begin{cases} \sqrt{2} K_l^m \cos(m \varphi) P_l^m(\cos\theta) & m \gt 0\\ \sqrt{2} K_l^m \sin(|m| \varphi) P_l^{|m|}(\cos\theta) & m \lt 0\\ K_l^0 P_l^0 (\cos \theta) & m = 0\\ \end{cases}\)

Visualizations

Below are distorted sphere visualizations where the radius corresponds to the value at each point.

Applications

Saliency

Ruofei did a project on Saliency using Spherical Harmonics as part of his PhD dissertation.

Resources

References