+
    Ai                         ^ RI Ht ^ RIt^RIHt ^RIHt ^t^t	R t
]! RR4      RR l4       t]! RR4      RR	 l4       t]! RR4      RR
 l4       tR# )    )reduceN)polygon)requirec                     \         P                  ! V\        R 7      pV  UUu. uF  w  rEVNK	  	  pppV  UUu. uF  w  rEVNK	  	  ppp\        WgV4      w  rW#W3&   V# u uppi u uppi ))dtype)npzerosintr   )
verticesshapelabelmaskxyprpcrrccs
   &&&       `/var/www/html/photoedit/myenv/lib/python3.14/site-packages/skimage/future/manual_segmentation.py_mask_from_verticesr      sb    88E%D 	!!B	! 	!!B	!RU#FBLK	 
"	!s
   AA"
matplotlibz>=3.3c                     ^ RI Hp ^ RIHp ^ RIHp V! VRR7      pV! V.RVR7      pV P                  V4      pVP                  4        V# )r   )Polygon)PatchCollectionNT)closed)match_originalalpha)matplotlib.patchesr   matplotlib.collectionsr   matplotlib.pyplotpyplotadd_collectiondraw)	axr   r   r   r   pltr   ppolygon_objects	   &&&      r   _draw_polygonr(      sF    *6#ht,G	$eDA&&q)NHHJ    c           	       a aaa	a
aaaaa ^ RI p^ RIHo . o
. o. o. oS P                  R9  d   \	        R4      hSP                  4       w  o	oS	P                  RR7       SP                  S RR7       SP                  4        V	V
V3R lpS	P                  . RO4      oVP                  P                  SR4      pVP                  V4       VVV
VVVVV3R	 lpS	P                  P                  R
V4       SP                  RR7       V 3R l\!        S
^R7       4       pV'       d   \"        P$                  ! V4      # \'        \"        P(                  V\"        P*                  ! ^ S P,                  R,          4      4      # )ay  Return a label image based on polygon selections made with the mouse.

Parameters
----------
image : (M, N[, 3]) array
    Grayscale or RGB image.

alpha : float, optional
    Transparency value for polygons drawn over the image.

return_all : bool, optional
    If True, an array containing each separate polygon drawn is returned.
    (The polygons may overlap.) If False (default), latter polygons
    "overwrite" earlier ones where they overlap.

Returns
-------
labels : array of int, shape ([Q, ]M, N)
    The segmented regions. If mode is `'separate'`, the leading dimension
    of the array corresponds to the number of regions that the user drew.

Notes
-----
Use left click to select the vertices of the polygon
and right click to confirm the selection once all vertices are selected.

Examples
--------
>>> from skimage import data, future
>>> import matplotlib.pyplot as plt  # doctest: +SKIP
>>> camera = data.camera()
>>> mask = future.manual_polygon_segmentation(camera)  # doctest: +SKIP
>>> fig, ax = plt.subplots()  # doctest: +SKIP
>>> ax.imshow(mask)           # doctest: +SKIP
>>> plt.show()                # doctest: +SKIP
N.Only 2D grayscale or RGB images are supported.皙?bottomgraycmapc                     < S'       dM   SP                  4        SP                  4       pVP                  4        SP                  P                  4        R # R # Npopremovecanvas	draw_idleargskwargs	last_polyfiglist_of_vertex_listspolygons_drawns   *, r   _undo*manual_polygon_segmentation.<locals>._undoX   A     $$&&**,IJJ  "  r)      ⟲c                   < V P                   e   V P                   SJ d   R # SP                  4       '       d   R # V P                  \        8X  dx   SP	                  V P
                  V P                  .4       S
'       d!   S
P                  4       pVP                  4        \        SSSR,          R7      pS
P	                  V4       R # V P                  \        8X  dw   S'       g   R # SP	                  SR,          4       \        SSSR7      pS	P	                  V4       S
P                  4       pVP                  4        SR SP                  4        R # R # )Ngffffff?r   :NNN)inaxesget_navigate_modebutton
LEFT_CLICKappendxdataydatar5   r6   r(   RIGHT_CLICKr#   )eventpolyr   r'   preview_polyr   r$   r>   r%   r?   preview_polygon_drawn	temp_listundo_poss   &    r   _extend_polygon4manual_polygon_segmentation.<locals>._extend_polygone   s   <<5<<8#;!!<<:%ekk5;;78$,002 $B	%#+GG!((1\\[(
 !''	!5*2yFN!!.1 1446L!!HHJ! )r)   button_press_eventTblockc              3   d   <"   T F%  w  r\        VSP                  R ,          V4      x  K'  	  R# 5iN   NNr   r   .0ir   images   &  r   	<genexpr>.manual_polygon_segmentation.<locals>.<genexpr>   .      CKA 	Hekk"oq99C   -0startr[   r\      g333333?g?333333?rk   )r   r    r!   ndim
ValueErrorsubplotssubplots_adjustimshowset_axis_offadd_axeswidgetsButton
on_clickedr7   mpl_connectshow	enumerater   stackr   maximumbroadcast_tor   )ra   r   
return_allr   r@   undo_buttonrT   labelsr$   r=   r>   r%   r?   rQ   rR   rS   s   ff&     @@@@@@@@r   manual_polygon_segmentationr   !   s2   L #NIzzIJJllnGCs#IIe&I!OO# ||67H$$++Hh?K5!# #J JJ/AHH4H$%9CF xxbjj&"//!U[[_*MNNr)   c           	       a aa	a
aaa ^ RI p^ RIHo . o. oS P                  R9  d   \	        R4      hSP                  4       w  o
o	S
P                  RR7       S	P                  S RR7       S	P                  4        V
VV3R lpS
P                  . RO4      pVP                  P                  VR4      pVP                  V4       VV	VVV3R	 lpVP                  P                  S	V4       SP                  R
R7       V 3R l\        S^R7       4       pV'       d   \         P"                  ! V4      # \%        \         P&                  V\         P(                  ! ^ S P*                  R,          4      4      # )a;  Return a label image based on freeform selections made with the mouse.

Parameters
----------
image : (M, N[, 3]) array
    Grayscale or RGB image.

alpha : float, optional
    Transparency value for polygons drawn over the image.

return_all : bool, optional
    If True, an array containing each separate polygon drawn is returned.
    (The polygons may overlap.) If False (default), latter polygons
    "overwrite" earlier ones where they overlap.

Returns
-------
labels : array of int, shape ([Q, ]M, N)
    The segmented regions. If mode is `'separate'`, the leading dimension
    of the array corresponds to the number of regions that the user drew.

Notes
-----
Press and hold the left mouse button to draw around each object.

Examples
--------
>>> from skimage import data, future
>>> import matplotlib.pyplot as plt  # doctest: +SKIP
>>> camera = data.camera()
>>> mask = future.manual_lasso_segmentation(camera)  # doctest: +SKIP
>>> fig, ax = plt.subplots()  # doctest: +SKIP
>>> ax.imshow(mask)           # doctest: +SKIP
>>> plt.show()                # doctest: +SKIP
Nr+   r,   r-   r/   r0   c                     < S'       dM   SP                  4        SP                  4       pVP                  4        SP                  P                  4        R # R # r3   r4   r9   s   *, r   r@   (manual_lasso_segmentation.<locals>._undo   rB   r)   rC   c                    < \        V 4      ^8  d   R# SP                  V 4       \        SV SR7      pSP                  V4       SP                  4        R# )ri   NrE   )lenrJ   r(   r#   )r   r'   r   r$   r>   r%   r?   s   & r   _on_lasso_selection6manual_lasso_segmentation.<locals>._on_lasso_selection   sE    x=1##H-&r85An-
r)   TrW   c              3   d   <"   T F%  w  r\        VSP                  R ,          V4      x  K'  	  R# 5irZ   r]   r^   s   &  r   rb   ,manual_lasso_segmentation.<locals>.<genexpr>   rd   re   rf   r[   rh   rj   )r   r    r!   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   LassoSelectorrw   rx   r   ry   r   rz   r{   r   )ra   r   r|   r   r@   rS   r}   r   r~   r$   r=   r>   r%   r?   s   ff&      @@@@@r   manual_lasso_segmentationr      s'   J #NzzIJJllnGCs#IIe&I!OO# ||67H$$++Hh?K5!  $$R)<=HH4H$%9CF xxbjj&"//!U[[_*MNNr)   )皙?)r   F)	functoolsr   numpyr   r#   r   _shared.version_requirementsr   rI   rM   r   r(   r   r    r)   r   <module>r      s|       2 
 	w	  	 	wsO  sOl 	wRO  ROr)   