evo.py 文件源码

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

项目:image-approx 作者: DING-PENG 项目源码 文件源码
def get_fitness(self, target):
        """
        Get fitness of the individual.
        This was calculated by RMS distance of histograms.

        Args:
            target: target image.

        Returns:
            the fitness value.
        """
        h = ImageChops.difference(target, self.im).histogram()
        return math.sqrt(reduce(operator.add,
                         map(lambda h, i: h*(i**2),
                             h, range(256)*3)) /
                            (float(target.size[0]) * target.size[1]))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号