I'm working on a computer vision problem and I want to use the Mahalanobis distance to cluster image patches (2D matrices having the same dimensions). I haven't been able to find any generalisation up to this point and would prefer not to vectorise my patches and end-up with a huge covariance matrix.
Since the exponent term in the multivariate Gaussian distribution density function is related to the Mahalanobis distance, I looked for a matrix version and I found the Matrix normal distribution:
The probability density function for the random matrix $\mathbf{X}(n\times p)$ that follows the matrix normal distribution $\mathcal{MN}_{n,p}(\mathbf{M}, \mathbf{U}, \mathbf{V})$ has the form:
$p(\mathbf{X}\mid\mathbf{M}, \mathbf{U}, \mathbf{V}) = \frac{\exp\left( -\frac{1}{2} \, \mathrm{tr}\left[ \mathbf{V}^{-1} (\mathbf{X} - \mathbf{M})^{T} \mathbf{U}^{-1} (\mathbf{X} - \mathbf{M}) \right] \right)}{(2\pi)^{np/2} |\mathbf{V}|^{n/2} |\mathbf{U}|^{p/2}} $
where $\mathrm{tr}$ denotes trace and $\mathbf{M}$ is $n\times p$, $\mathbf{U}$ is $n\times n$ and $\mathbf{V}$ is $p\times p$.
Now, my question is : is the trace term a generalisation of the Mahalanobis distance applied on matrices or is there another formulation ?