  We study existence, structure, uniqueness and regularity of solutions of the
obstacle problem \begin{equation*} \inf_{u\in
BV_f(\Omega)}\int_{\mathbb{R}^n}\phi(x,Du), \end{equation*} where
$BV_f(\Omega)=\{u\in BV(\Omega): u\geq \psi \text{ in }\Omega\text{ and }
u|_{\partial \Omega}=f|_{\partial \Omega}\}$, $f \in W^{1,1}_0(\mathbb{R}^n)$,
$\psi$ is the obstacle, and $\phi(x,\xi)$ is a convex, continuous and
homogeneous function of degree one with respect to the $\xi$ variable. We show
that every minimizer of this problem is also a minimizer of the least gradient
problem \[\inf_{u\in \mathcal{A}_f(\Omega)}\int_{\mathbb{R}^n}\phi(x,Du),\]
  where $\mathcal{A}_f(\Omega)=\{u\in BV(\Omega): u\geq \psi, \text{ and } u=f
\text{ in }\Omega^c\}$. Moreover, there exists a vector field $T$ with $\nabla
\cdot T \leq 0$ in $\Omega$ which determines the structure of all minimizers of
these two problems, and $T$ is divergence free on $\{x\in \Omega:
u(x)>\psi(x)\}$ for any minimizer $u$. We also present uniqueness and
regularity results that are based on maximum principles for minimal surfaces.
Since minimizers of the least gradient problems with obstacle do not hit small
enough obstacles, the results presented in this paper extend several results in
the literature about least gradient problems without obstacle.
