A Document Image Restoration Algorithm based on Markov Random Field