In this recipe, we shall discuss how a Markov random field (MRF) can be used to denoise an image. Let's say we have a noisy binary image, X, with pixel values Xij ∈ {-1, +1} and we want to recover the noiseless image, Y. If the amount of noise is assumed to be small, there will be a good correlation between a pixel in X and the corresponding pixel in Y and in a 4-connected neighborhood, pixels of X will be well-correlated. This can be modeled as an MRF as shown in the following diagram, with the total energy function that we shall like to minimize:
Image restoration with a Markov random field
Getting ready
In this recipe, we will use the cameraman grayscale image and we will corrupt the image with noise. Next...