A Multilevel GMRF based approach to image segmentation and restoration