def addFilter(self,f,recenter=False):
'''
f can be a function f(x,y) is defined over x = (-w/2, w/2] and
y = (-h/2,h/2] and should be centered on the coord 0,0.
TODO: At some point this function should be expanded to take filters
represented by arrays.
'''
if recenter == True:
raise NotImplementedError
if isinstance(f,GaborWavelet):
filt = np.fft.fft2(f.mask(self.tile_size))
self.filters.append(filt)
else:
w,h = self.tile_size
m = np.zeros((w,h),np.complex64)
for x in range(-w/2,w/2):
for y in range(-h/2,h/2):
m[x,y] = f(x,y)
filt = np.fft.fft2(m)
self.filters.append(filt.conj())
评论列表
文章目录