Discrete approximation of a free discontinuity problem