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
Get Python Image Processing Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.