To
simplify our notation we first define a single-channel intermediate
image I that encodes the sum of squared differences between S and
B, i.e. the pixel-wise squared Euclidean distance between S and
B. Let fp; qg 2 Np(I ) denote the four pairs of pixels that form the
4-neighborhood of pixel p in I .