  We study a nonlocal perimeter functional inspired by the Minkowski content,
whose main feature is that it interpolates between the classical perimeter and
the volume functional. This problem is related by a generalized coarea formula
to a Dirichlet energy functional in which the energy density is the local
oscillation of a function.
  These two nonlocal functionals arise in concrete applications, since the
nonlocal character of the problems and the different behaviors of the energy at
different scales allow the preservation of details and irregularities of the
image in the process of removing white noises, thus improving the quality of
the image without losing relevant features.
  In this paper, we provide a series of results concerning existence, rigidity
and classification of minimizers, compactness results, isoperimetric
inequalities, Poincar\'e-Wirtinger inequalities and density estimates.
Furthermore, we provide the construction of planelike minimizers for this
generalized perimeter under a small and periodic volume perturbation.
