
    a6dT                          d dl ZddlmZ d ZdS )    N   )drawc                     t          j        |          }|j        \  }}t          j        |||           \  }}t          j        | t                    }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masks          :lib/python3.11/site-packages/skimage/draw/_polygon2mask.pypolygon2maskr      sg    : j!!G+29(('+|,k(; (;$O_8Kt,,,D-1D/	)*K    )numpyr    r   r    r   r   <module>r      s<             # # # # #r   