GaborJets.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:nimo 作者: wolfram2012 项目源码 文件源码
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())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号