A numerical solution to fitting a 2D Gaussian to a matrix is given at https://mathematica.stackexchange.com/questions/27642/fitting-a-two-dimensional-gaussian-to-a-set-of-2d-pixels.

My question is:

  1. Is it possible to formulate this problem as an optimization program?
  2. If yes, then will the resulting program be solvable. In other words will it be a convex program?

My work so far:

For a given matrix $\mathbf{A}\in\mathcal{R}^{N\times N}$,

  1. Objective function is:$$\min_\mathbf{Z} \quad \sum_{i,j=1}^{N}(\mathbf{Z}_{i,j}-\mathbf{A}_{i,j})^2 $$
  2. I dont know how to write this constraint set in mathematical notation:$\mathbf{Z}\quad\text{is matrix generated from sampling a 2D Gaussian distribution} \quad f(x_1,x_2) \quad \text{at integer locations}$

where a 2D Gaussian Distribution is defined as \begin{equation} f(x_1,x_2) = \frac{e^{-(\mathbf{X}-\mathbf{\mu})^{T}\Sigma^{-1}(\mathbf{X}-\mathbf{\mu})^{}}}{2\pi\sqrt{|\Sigma|}} \end{equation}

where $\mathbf{X}=\begin{bmatrix}x_1\\ x_2\end{bmatrix}$, $\mathbf{\mu}=\begin{bmatrix}\mu_1\\ \mu_2\end{bmatrix}$, and $\Sigma=\begin{bmatrix}\sigma_1^2 & \rho\sigma_1^{}\sigma_2^{}\\ \rho\sigma_1^{}\sigma_2^{} & \sigma_2^2\end{bmatrix}$. Also $\mu_i,\sigma_i\geq0 \forall i$ and $-1\leq\rho\leq1$.

  1. Would it be helpful if we search over $\mathbf{\mu},\mathbf{\Sigma}$ and $\rho$?

Please feel free to edit/comment.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.