pillow.py 文件源码

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

项目:pillow-perf 作者: python-pillow 项目源码 文件源码
def gaussian_blur(cls, self, radius, n=3):
        if self.mode == 'RGBA':
            return cls.gaussian_blur(self.convert('RGBa'),
                                     radius, n).convert('RGBA')

        if self.mode == 'LA':
            return cls.gaussian_blur(self.convert('La'),
                                     radius, n).convert('LA')

        # http://www.mia.uni-saarland.de/Publications/gwosdek-ssvm11.pdf
        # [7] Box length.
        L = math.sqrt(12.0 * float(radius) * radius / n + 1.0)
        # [11] Box radius.
        l = (L - 1.0) / 2.0
        # Integer part.
        li = math.floor(l)
        # Reduce the fractional part in accordance with tests.
        a = math.e ** (2.5 * (l - li) / (li + 1)) - 1
        a /= math.e ** (2.5 / (li + 1)) - 1
        box_radius = li + a

        self.load()
        return self._new(self.im.box_blur(box_radius, n))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号