Computation of the perimeter of measurable sets via their covariogram : applications to random sets