Quasar > Image Processing > Pattern matching

Pattern matching

PatchMatching.q

Small module that illustrates how to match patches in an image.
The technique computes the mean squared error (MSE) between a "template" patch and the image itself, as follows:
MSE(patch, image[j]) = 1/B^2 sum_i((patch[i] - image[i+j]).^2) = 1/B^2 sum_i(patch[i].^2) + 1/B^2 sum_i(image[i+j].^2)
• 2/B^2 sum_i(patch[i] .* image[i+j])
Here, the first term is a constant; the second term is computed using an integral image representation. Finally, the third term is obtained using the Discrete Fourier transform (correlation method)

See patchmatching.q


An overview of the different functions and classes:

integral_image2DComputes the integral image representation of a given image. This facilitates obtaining sums of rectangular blocks of an image.
PatchMatching.qSmall module that illustrates how to match patches in an image.