The intensity normalization is currently clipping intensities. This should not be the case to perform zero-normalized cross-correlation.
Parameters
----------
window : 2d np.ndarray
the interrogation window array
Returns
-------
window : 2d np.ndarray
the interrogation window array, with mean value equal to zero and
intensity normalized to -1 +1 and clipped if some pixels are
extra low/high
"""
# Convert to float32 only if needed, otherwise work in-place
if window.dtype != np.float32:
window = window.astype(np.float32)
else:
window = window.copy() # Still need a copy to avoid modifying input
window -= window.mean(axis=(-2, -1),
keepdims=True, dtype=np.float32)
tmp = window.std(axis=(-2, -1), keepdims=True)
window = np.divide(window, tmp, out=np.zeros_like(window),
where=(tmp != 0))
return np.clip(window, 0, window.max())`
The intensity normalization is currently clipping intensities. This should not be the case to perform zero-normalized cross-correlation.
`def normalize_intensity(window):
"""Normalize interrogation window or strided image of many windows,
by removing the mean intensity value per window and clipping the
negative values to zero