source
NormalizedCrossCorrelation2d
NormalizedCrossCorrelation2d (patch_size=None)
Compute Normalized Cross Correlation between two batches of images.
source
GradientNormalizedCrossCorrelation2d
GradientNormalizedCrossCorrelation2d (patch_size=None, sigma=1.0)
Compute Normalized Cross Correlation between the image gradients of two batches of images.
x1 = torch.randn(8, 1, 128, 128)
x2 = torch.randn(8, 1, 128, 128)
ncc = NormalizedCrossCorrelation2d()
ncc(x1, x2)
ncc = NormalizedCrossCorrelation2d(patch_size=9)
ncc(x1, x2)
gncc = GradientNormalizedCrossCorrelation2d()
gncc(x1, x2)
gncc = GradientNormalizedCrossCorrelation2d(patch_size=9)
gncc(x1, x2)
tensor([ 0.0039, -0.0092, 0.0008, 0.0022, -0.0049, -0.0204, -0.0088, 0.0056])