当前位置: 首页>>代码示例>>Python>>正文


Python Translation.range方法代码示例

本文整理汇总了Python中menpo.transform.Translation.range方法的典型用法代码示例。如果您正苦于以下问题:Python Translation.range方法的具体用法?Python Translation.range怎么用?Python Translation.range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在menpo.transform.Translation的用法示例。


在下文中一共展示了Translation.range方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _build_reference_frame

# 需要导入模块: from menpo.transform import Translation [as 别名]
# 或者: from menpo.transform.Translation import range [as 别名]
def _build_reference_frame(landmarks, boundary=3, group='source'):
    # translate landmarks to the origin
    minimum = landmarks.bounds(boundary=boundary)[0]
    landmarks = Translation(-minimum).apply(landmarks)

    resolution = landmarks.range(boundary=boundary)
    reference_frame = MaskedImage.blank(resolution)
    reference_frame.landmarks[group] = landmarks

    return reference_frame
开发者ID:jalabort,项目名称:ijcv-2014-aam,代码行数:12,代码来源:utils.py

示例2: init_from_pointcloud

# 需要导入模块: from menpo.transform import Translation [as 别名]
# 或者: from menpo.transform.Translation import range [as 别名]
    def init_from_pointcloud(cls, pointcloud, group=None, boundary=0,
                             constrain=True, fill=True):
        r"""
        Create an Image that is big enough to contain the given pointcloud.
        The pointcloud will be translated to the origin and then translated
        according to its bounds in order to fit inside the new image.
        An optional boundary can be provided in order to increase the space
        around the boundary of the pointcloud. The boundary will be added
        to *all sides of the image* and so a boundary of 5 provides 10 pixels
        of boundary total for each dimension.

        By default, the mask will be constrained to the convex hull of the
        provided pointcloud.

        Parameters
        ----------
        pointcloud : :map:`PointCloud`
            Pointcloud to place inside the newly created image.
        group : `str`, optional
            If ``None``, the pointcloud will only be used to create the image.
            If a `str` then the pointcloud will be attached as a landmark
            group to the image, with the given string as key.
        boundary : `float`
            A optional padding distance that is added to the pointcloud bounds.
            Default is ``0``, meaning the max/min of tightest possible
            containing image is returned.
        fill : `int`, optional
            The value to fill all pixels with.
        constrain : `bool`, optional
            If ``True``, the ``True`` values will be image will be constrained
            to the convex hull of the provided pointcloud. If ``False``,
            the mask will be the value of ``fill``.

        Returns
        -------
        image : :map:`MaskedImage`
            A new image with the same size as the given pointcloud, optionally
            with the pointcloud attached as landmarks and the mask constrained
            to the convex hull of the pointcloud.
        """
        # Translate pointcloud to the origin
        minimum = pointcloud.bounds(boundary=boundary)[0]
        origin_pc = Translation(-minimum).apply(pointcloud)
        image_shape = origin_pc.range(boundary=boundary)
        new_image = cls.init_blank(image_shape, fill=fill)
        if constrain:
            new_image = new_image.constrain_to_pointcloud(origin_pc)
        if group is not None:
            new_image.landmarks[group] = origin_pc
        return new_image
开发者ID:yuxiang-zhou,项目名称:menpo,代码行数:52,代码来源:boolean.py


注:本文中的menpo.transform.Translation.range方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。