def cross_corr_norm(patch_0, patch_1):
    """
    Returns the normalized cross-correlation between two same-sized image
    patches.

    Parameters           :
        patch_0, patch_1 : image patches
    """
    n = patch_0.shape[0] * patch_0.shape[1]

    # Mean intensities
    mu_0, mu_1 = patch_0.mean(), patch_1.mean()

    # Standard deviations
    sigma_0, sigma_1 = patch_0.std(), patch_1.std()

    return (1.0 / (n - 1) * (((patch_0 - mu_0) / sigma_0) *
                             ((patch_1 - mu_1) / sigma_1)).sum())