image.py 文件源码

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

项目:sldc 作者: waliens 项目源码 文件源码
def window_from_polygon(self, polygon, mask=False):
        """Build and return a window being the minimum bounding box around the passed polygon.
        At least a part of the polygon should fit the image

        Parameters
        ----------
        polygon: shapely.geometry.Polygon
            The polygon of which the minimum bounding window should be returned
        mask: boolean (optional, default: False)
            True for applying a mask to the image

        Returns
        -------
        window: ImageWindow
            The resulting image window

        Raises
        ------
        IndexError: if the polygon box offset is not inside the image
        """
        offset, width, height = Image.polygon_box(polygon)
        if not self._check_tile_offset(offset):
            raise IndexError("Offset {} is out of the image.".format(offset))
        return self.window(offset, width, height, polygon_mask=polygon if mask else None)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号