# Wasserstein barycenters and applications in image processing

In optimal transport, a Wasserstein barycenter [1] is a probability measure that acts as a center of mass between two or more probability measures. It generalizes the notions of physical barycenters and geometric centroids.

## Introduction

### Motivation

Barycenters in physics and geometry are points that represent a notion of a mean of a number of objects. In astronomy, the barycenter is the center of mass of two or more objects that orbit each other, and in geometry, a centroid is the arithmetic mean of all the points in an object. Given countably many points ${\displaystyle \{x_{i}\}_{i\in I}}$ in ${\displaystyle \mathbb {R} ^{n}}$ with nonnegative weights ${\displaystyle \{\lambda _{i}\}_{i\in I}}$, the weighted ${\displaystyle L^{2}}$ barycenter of the points is the unique point ${\displaystyle y}$ minimizing ${\displaystyle \sum _{i\in I}\lambda _{i}||y-x_{i}||_{2}^{2}}$. Wasserstein barycenters attempt to capture this concept for probability measures by replacing the Euclidean distance with the Wasserstein distance of two probability measures, ${\displaystyle W_{2}(\rho ,\mu )}$.

### Definition

Let ${\displaystyle \Omega }$ be a domain and ${\displaystyle {\mathcal {P}}(\Omega )}$ be the set of probability measures on ${\displaystyle \Omega }$. Given a collection of probability measures ${\displaystyle \{\mu _{i}\}_{i\in I}}$ and nonnegative weights ${\displaystyle \{\lambda _{i}\}_{i\in I}}$, we define a weighted barycenter of ${\displaystyle \{\mu _{i}\}_{i\in I}}$ as any probability measure ${\displaystyle \mu }$ that minimizes  ${\displaystyle \sum _{i\in I}\lambda _{i}W_{2}(\mu _{i},\mu )^{2}}$ over the space ${\displaystyle \mu \in {\mathcal {P}}(\Omega )}$. Here ${\displaystyle W_{2}}$ denotes the 2-Wasserstein distance, which may be replaced with the ${\displaystyle p}$-Wasserstein distance, ${\displaystyle W_{p}}$, though this is not always as convenient.

This minimization problem was originally introduced by Agueh and Carlier [2], who also proposed an alternative formulation of the problem above when there are finitely many measures ${\displaystyle \{\mu _{i}\}_{i=1}^{N}}$. Instead of considering the minimum over all probability measures ${\displaystyle \mu \in {\mathcal {P}}(\Omega )}$, one can equivalently consider the optimization problem over all multi-marginal transport plans ${\displaystyle \gamma \in {\mathcal {P}}(\Omega ^{N+1})}$ whose push forwards satisfy ${\displaystyle (\pi _{i})_{\#}\gamma =\mu _{i}}$ for ${\displaystyle i\in \{1,\ldots ,N\}}$ and ${\displaystyle (\pi _{0})_{\#}\gamma =\mu }$ for some unspecified probability measure ${\displaystyle \mu }$. The problem then tries to minimize

${\displaystyle \int \left(\sum _{i=1}^{N}\lambda _{i}\|x_{i}-x_{0}\|^{2}\right)d\gamma }$

### Existence and Uniqueness

Agueh and Carlier [3] demonstrated that when at least one of the measures ${\displaystyle \mu _{i}}$ is absolutely continuous, the Wasserstein barycenter exists and is unique.

### Examples[4]

In the case where all of the measures ${\displaystyle \mu _{i}}$ are finitely supported measures, computing the Wasserstein barycenter reduces to a problem in linear programming.

When the family of measures ${\displaystyle \{\mu _{i}\}_{i\in I}}$ consists of only one finitely supported measure ${\displaystyle \mu _{1}}$ and we restrict the input probability measure ${\displaystyle \mu }$ to finitely supported probability measures whose supports have at most ${\displaystyle k}$ points, the problem of finding the Wasserstein barycenter is equivalent to the ${\displaystyle k}$-means clustering problem.

## Applications

### Barycenters in Image Processing

Barycenters have several applications in image processing. A basic example[5] arises in handwriting recognition. One may wish to determine what an expected letter looks like, but simply taking the pixel-by-pixel Euclidean average won't capture the geometric information of the letter. Instead, a ${\displaystyle k}$-means algorithm can compute what a prototypical version of that letter looks like.

As another application, barycenters can be used to interpolate between two or more images[6]. For example, suppose we are given two images of similar objects, one with a darker gray-scale histogram ${\displaystyle \mu _{1}}$ and the other with a lighter one ${\displaystyle \mu _{2}}$. One way to find the middle point of their histograms would be to take their Euclidean average ${\displaystyle (\mu _{1}+\mu _{2})/2}$, but this would result in a histogram with a distribution of some dark and some light shades as opposed to a gray-scaled version. The Wasserstein barycenter between these two histograms provides a gray image. Similar ideas can be used to enhance the contrast of an image.

## Generalizations

Wasserstein barycenters are examples of Karcher and Fréchet means where the distance function used is the Wasserstein distance.

### References

1. Santambrogio, Filippo. Optimal Transport for Applied Mathematicians. Birkhäuser., 2015.
2. Martial Agueh, Guillaume Carlier. Barycenters in the Wasserstein space. SIAM Journal on Mathematical Analysis, Society for Industrial and Applied Mathematics, 2011, 43 (2), pp.904-924. ff10.1137/100805741ff. ffhal-00637399f
3. Martial Agueh, Guillaume Carlier. Barycenters in the Wasserstein space. SIAM Journal on Mathematical Analysis, Society for Industrial and Applied Mathematics, 2011, 43 (2), pp.904-924. ff10.1137/100805741ff. ffhal-00637399f
4. Peyré, Gabriel and Marco Cuturi. “Computational Optimal Transport.” Found. Trends Mach. Learn. 11 (2019): 355-607.
5. Claici, Sebastian. “Stochastic Wasserstein Barycenters.” Lecture, MIT, July, 2018.
6. Santambrogio, Filippo. Optimal Transport for Applied Mathematicians. Birkhäuser., 2015.