o
    :ήcT                     @   s    d dl ZddlmZ dd ZdS )    N   )drawc                 C   sD   t |}|j\}}t||| \}}t j| td}d|||f< |S )a  Compute a mask from polygon.

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

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

    Notes
    -----
    This function does not do any border checking, so that all
    the vertices need to be within the given shape.

    Examples
    --------
    >>> image_shape = (128, 128)
    >>> polygon = np.array([[60, 100], [100, 40], [40, 40]])
    >>> mask = polygon2mask(image_shape, polygon)
    >>> mask.shape
    (128, 128)
    )dtypeT)npasarrayTr   polygonzerosbool)image_shaper   vertex_row_coordsvertex_col_coordsfill_row_coordsfill_col_coordsmask r   A/tmp/pip-target-vg8gfxp4/lib/python/skimage/draw/_polygon2mask.pypolygon2mask   s   

r   )numpyr    r   r   r   r   r   r   <module>   s    