def test_bowtie(self):
# Test the bowtie filter with sine waves
wDeg = 3
nPix = 257
sf = 1
orientation = 0
x = y = np.linspace(-wDeg // 2, wDeg // 2, nPix + 1)
u, v = np.meshgrid(x, y)
ramp = np.sin(orientation * np.pi / 180) * u
ramp -= np.cos(orientation * np.pi / 180) * v
img = np.sin(2 * np.pi * sf * ramp)
fimg = fft2(img)
orientation_widths = [1, 10, 20, 40, 80, 100]
for x in orientation_widths:
filt = OrientationFilter('bowtie', 90, x, nPix, .2, nPix + 1,
'triangle')
filt = filt.filter
filt = 1 - filt
filt = fftshift(filt)
out = ifft2(fimg * filt).real.astype(int)
self.assertEqual(np.sum(out), 0)
test_orientation_filter.py 文件源码
python
阅读 42
收藏 0
点赞 0
评论 0
评论列表
文章目录