def test_real_input(): reference_image = camera() subpixel_shift = (-2.4, 1.32) shifted_image = fourier_shift(fft.fftn(reference_image), subpixel_shift) shifted_image = fft.ifftn(shifted_image) # subpixel precision result, error, diffphase = register_translation(reference_image, shifted_image, 100) assert_allclose(result[:2], -np.array(subpixel_shift), atol=0.05)
def test_real_input(): reference_image = camera() subpixel_shift = (-2.4, 1.32) shifted_image = fourier_shift(fft.fftn(reference_image), subpixel_shift) shifted_image = fft.ifftn(shifted_image) # subpixel precision result, error, diffphase = phase_cross_correlation(reference_image, shifted_image, upsample_factor=100) assert_allclose(result[:2], -np.array(subpixel_shift), atol=0.05)
def test_real_input(dtype): reference_image = camera().astype(dtype, copy=False) subpixel_shift = (-2.4, 1.32) shifted_image = fourier_shift(fft.fftn(reference_image), subpixel_shift) shifted_image = fft.ifftn(shifted_image).real.astype(dtype, copy=False) # subpixel precision result, error, diffphase = phase_cross_correlation(reference_image, shifted_image, upsample_factor=100) assert result.dtype == _supported_float_type(dtype) assert_allclose(result[:2], -np.array(subpixel_shift), atol=0.05)