Q:

Averaging maps of Riemannian manifolds

Let $M$ be a compact Riemannian manifold. We know how to average functions $f\colon M\to {\mathbb R}$; the integral $\frac{\int_M f}{\int_M 1}$ returns a value in ${\mathbb R}$. If intead $f\colon M\to {\mathbb R}^n$, then integrating each component of $f$ separately returns a value in ${\mathbb R}^n$.
What happens if $f\colon M\to N$ and $N$ is again a Riemannian manifold? In which cases can one average maps to $N$ in a canonical way that depends only on the Riemannian structure of $N$? The value of such averaging should be a point  in $N$.
A possible way of obtaining this value could be to take the minimum in $y\in N$ of the following function $g$:
\begin{equation}g(y) = \int_M d(y,f(x))dx,\end{equation}
and I only expect this minimum to exist and be unique if $M$ is diffeomorphic to a convex subset of ${\mathbb R}^n$ and its Riemannian metric is close to the standard metric (which is the case in which I am interested).

A:

The anwer to this question follows from Theorem 1.2 in the paper

Karcher, H. Riemannian center of mass and mollifier smoothing.  Comm.
  Pure Appl. Math. 30 (1977), no. 5, 509–541.

provided by Igor Belegradek in the comments. More specifically, the function on $N$
\begin{equation}
g(y) = \frac{1}{2}\int_M d(y,f(x))^2dx 
\end{equation}
has a unique minimum when $N$ is a convex ball (i.e., for any p,q\in N, there is a unique geodesic between them, and it lies in the ball) and either of the following conditions hold:

The sectional curvatures at each point of the ball are non-positive,  
The sectional curvatures at each point of the ball are bounded by $\Delta>0$, in which case the radius of the ball should be strictly less than $\frac{1}{2}\pi\Delta^{-1/2}$. 

