The Gamma-limit for singularly perturbed functionals of Perona-Malik type in arbitrary dimension