match_template_dilate#
- pyxem.utils.diffraction.match_template_dilate(image, template, template_dilation=2, mode='constant', constant_values=0)[source]#
Matches a template with an image using a window normalized cross-correlation.
This performs very well for image with different background intensities. This is a slower version of the skimage
skimage.feature.match_template()
but performs better for images with circular variations in background intensity, specifically accounting for an amorphous halo around the diffraction pattern.- Parameters:
image (np.array) – Image to be matched
template (np.array) – Template to preform the normalized cross-correlation with
template_dilation (int) – The number of pixels to dilate the template by for the windowed cross-correlation
mode (str) – Padding mode for the image. Options are ‘constant’, ‘edge’, ‘wrap’, ‘reflect’
constant_values (int) – Value to pad the image with if mode is ‘constant’
- Returns:
response – The windowed cross-correlation of the image and template
- Return type:
np.array