imagehasher.py 文件源码

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

项目:Comictagger 作者: dickloraine 项目源码 文件源码
def average_hash2( self ):
        pass
        """
        # Got this one from somewhere on the net.  Not a clue how the 'convolve2d'
        # works! 

        from numpy import array 
        from scipy.signal import convolve2d

        im = self.image.resize((self.width, self.height), Image.ANTIALIAS).convert('L')

        in_data = array((im.getdata())).reshape(self.width, self.height)
        filt = array([[0,1,0],[1,-4,1],[0,1,0]])
        filt_data = convolve2d(in_data,filt,mode='same',boundary='symm').flatten()

        result = reduce(lambda x, (y, z): x | (z << y),
                         enumerate(map(lambda i: 0 if i < 0 else 1, filt_data)),
                         0)
        #print "{0:016x}".format(result)
        return result
        """
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号