Ë
    ÿ[;jò	  ã                   ó   — d dl ZddlmZ d„ Zy)é    Né   )Údrawc                 óÆ   — t        j                  |«      }|j                  \  }}t        j                  ||| «      \  }}t        j
                  | t        ¬«      }d|||f<   |S )a  Create a binary mask from a polygon.

    Parameters
    ----------
    image_shape : tuple of size 2
        The shape of the mask.
    polygon : (N, 2) array_like
        The polygon coordinates of shape (N, 2) where N is
        the number of points. The coordinates are (row, column).

    Returns
    -------
    mask : 2-D ndarray of type 'bool'
        The binary mask that corresponds to the input polygon.

    See Also
    --------
    polygon:
        Generate coordinates of pixels inside a polygon.

    Notes
    -----
    This function does not do any border checking. Parts of the polygon that
    are outside the coordinate space defined by `image_shape` are not drawn.

    Examples
    --------
    >>> import skimage as ski
    >>> image_shape = (10, 10)
    >>> polygon = np.array([[1, 1], [2, 7], [8, 4]])
    >>> mask = ski.draw.polygon2mask(image_shape, polygon)
    >>> mask.astype(int)
    array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
           [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
           [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
           [0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
           [0, 0, 0, 1, 1, 1, 1, 0, 0, 0],
           [0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
           [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
           [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
           [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])

    If vertices / points of the `polygon` are outside the coordinate space
    defined by `image_shape`, only a part (or none at all) of the polygon is
    drawn in the mask.

    >>> offset = np.array([[2, -4]])
    >>> ski.draw.polygon2mask(image_shape, polygon - offset).astype(int)
    array([[0, 0, 0, 0, 0, 0, 1, 1, 1, 1],
           [0, 0, 0, 0, 0, 0, 1, 1, 1, 1],
           [0, 0, 0, 0, 0, 0, 0, 1, 1, 1],
           [0, 0, 0, 0, 0, 0, 0, 1, 1, 1],
           [0, 0, 0, 0, 0, 0, 0, 0, 1, 1],
           [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
           [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
    )ÚdtypeT)ÚnpÚasarrayÚTr   ÚpolygonÚzerosÚbool)Úimage_shaper
   Úvertex_row_coordsÚvertex_col_coordsÚfill_row_coordsÚfill_col_coordsÚmasks          úcG:\00. PROJECTS\API\Inventory\templateJSON\kerjaOCR\Lib\site-packages\skimage/draw/_polygon2mask.pyÚpolygon2maskr      sd   € ôz �j‰j˜Ó!€GØ+2¯9©9Ñ(ÐÐ(Ü'+§|¡|ØÐ,¨kó(Ñ$€O�_ô �8‰8�K¤tÔ,€DØ-1€Dˆ˜/Ð	)Ñ*Ø€Kó    )Únumpyr   Ú r   r   © r   r   Ú<module>r      s   ðÛ å óDr   