def resizeFilter(filter,size):
filter = np.fft.ifft2(filter)
w,h = size
fw,fh = filter.shape
tmp = np.zeros((w,h), np.complex128) #TODO: check this
w = min(w,fw)
h = min(h,fh)
tmp[ :w/2, :h/2] = filter[ :w/2, :h/2]
tmp[ :w/2,-h/2:] = filter[ :w/2,-h/2:]
tmp[-w/2:,-h/2:] = filter[-w/2:,-h/2:]
tmp[-w/2:, :h/2] = filter[-w/2:, :h/2]
return np.fft.fft2(tmp)
评论列表
文章目录