+
    UBiw                    J    ^ RI Ht ^ RIt^ RIHt ^RIHt  ! R R4      t]tR# )    )annotationsN)cached_property)Imagec                      ] tR t^tRR R llt]R R l4       t]R R l4       t]R R	 l4       t]R
 R l4       t	]R R l4       t
]R R l4       t]R R l4       t]R R l4       t]R R l4       tRtR# )StatNc               $    V ^8  d   QhRRRRRR/# )   image_or_listzImage.Image | list[int]maskzImage.Image | NonereturnNone )formats   "2/usr/lib/python3.14/site-packages/PIL/ImageStat.py__annotate__Stat.__annotate__    s$     5 545<N5	5    c                .   \        V\        P                  4      '       d   VP                  V4      V n        M*\        V\        4      '       d   Wn        MRp\        V4      h\	        \        \        V P                  4      R,          4      4      V n        R# )a  
Calculate statistics for the given image. If a mask is included,
only the regions covered by that mask are included in the
statistics. You can also pass in a previously calculated histogram.

:param image: A PIL image, or a precalculated histogram.

    .. note::

        For a PIL image, calculations rely on the
        :py:meth:`~PIL.Image.Image.histogram` method. The pixel counts are
        grouped into 256 bins, even if the image has more than 8 bits per
        channel. So ``I`` and ``F`` mode images have a maximum ``mean``,
        ``median`` and ``rms`` of 255, and cannot have an ``extrema`` maximum
        of more than 255.

:param mask: An optional mask.
z$first argument must be image or list   N)	
isinstancer   	histogramhlist	TypeErrorrangelenbands)selfr
   r   msgs   &&& r   __init__Stat.__init__    sf    * mU[[11",,T2DFt,,"F8CC. %DFFs 234
r   c                   V ^8  d   QhRR/# )r	   r   zlist[tuple[int, int]]r   )r   s   "r   r   r   ?   s     H H. Hr   c                    R R lp\        ^ \        V P                  4      R4       Uu. uF  q!! V P                  VR 4      NK  	  up# u upi )a%  
Min/max values for each band in the image.

.. note::
    This relies on the :py:meth:`~PIL.Image.Image.histogram` method, and
    simply returns the low and high bins used. This is correct for
    images with 8 bits per channel, but fails for other modes such as
    ``I`` or ``F``. Instead, use :py:meth:`~PIL.Image.Image.getextrema` to
    return per-band extrema for the image. This is more correct and
    efficient because, for non-8-bit modes, the histogram method uses
    :py:meth:`~PIL.Image.Image.getextrema` to determine the bins used.
c                    V ^8  d   QhRRRR/# )r	   r   	list[int]r   ztuple[int, int]r   )r   s   "r   r   "Stat.extrema.<locals>.__annotate__M   s     
	$ 
	$i 
	$O 
	$r   c                    ^^ r!\        R4       F  pW,          '       g   K  Tp M	  \        ^RR4       F  pW,          '       g   K  Tp W3# 	  W3# )   r   )r   )r   res_minres_maxis   &   r   minmaxStat.extrema.<locals>.minmaxM   s^    "AW3Z<<G   3B'<<G##	 ( ##r   r   N)r   r   r   )r   r-   r,   s   &  r   extremaStat.extrema>   sC    
	$ -2!S[#,FG,Fqtvvabz",FGGGs   A	c                   V ^8  d   QhRR/# r	   r   r%   r   )r   s   "r   r   r   \   s     N Ny Nr   c           	         \        ^ \        V P                  4      R4       Uu. uF!  p\        V P                  WR,            4      NK#  	  up# u upi )z2Total number of pixels for each band in the image.r   )r   r   r   sumr   r,   s   & r   count
Stat.count[   sA     383tvv;2LM2LQDFF13w'(2LMMMs   'Ac                   V ^8  d   QhRR/# r	   r   zlist[float]r   )r   s   "r   r   r   a   s     	 	[ 	r   c                    . p\        ^ \        V P                  4      R4       FN  pRp\        R4       F)  pW4V P                  W$,           ,          ,          ,          pK+  	  VP                  V4       KP  	  V# )z-Sum of all pixels for each band in the image.r           )r   r   r   append)r   vr,   	layer_sumjs   &    r   r4   Stat.sum`   sa     q#dff+s+AI3Z..	  HHY	 ,
 r   c                   V ^8  d   QhRR/# r9   r   )r   s   "r   r   r   m   s     	 	k 	r   c           	        . p\        ^ \        V P                  4      R4       F^  pRp\        R4       F9  pW4^,          \        V P                  W$,           ,          4      ,          ,          pK;  	  VP	                  V4       K`  	  V# )z5Squared sum of all pixels for each band in the image.r   r;   )r   r   r   floatr<   )r   r=   r,   sum2r?   s   &    r   rD   	Stat.sum2l   si     q#dff+s+AD3ZAtvvae}!555  HHTN	 ,
 r   c                   V ^8  d   QhRR/# r9   r   )r   s   "r   r   r   y   s     Y Yk Yr   c                    V P                    Uu. uFH  qP                  V,          '       d,   V P                  V,          V P                  V,          ,          M^ NKJ  	  up# u upi )zAAverage (arithmetic mean) pixel level for each band in the image.)r   r6   r4   r5   s   & r   mean	Stat.meanx   sF     NRZZXZzz!}}djjm+!CZXXXs   AA c                   V ^8  d   QhRR/# r2   r   )r   s   "r   r   r   ~   s      	 r   c                   . pV P                    Fr  p^ pV P                  V,          ^,          pVR,          p\        R4       F*  pW0P                  WV,           ,          ,           pW48  g   K*   M	  VP	                  X4       Kt  	  V# )z.Median pixel level for each band in the image.r   )r   r6   r   r   r<   )r   r=   r,   shalfbr?   s   &      r   medianStat.median}   ss     AA::a=A%DCA3Zqu%8   HHQK  r   c                   V ^8  d   QhRR/# r9   r   )r   s   "r   r   r      s     
 
[ 
r   c                    V P                    Uu. uF]  pV P                  V,          '       d@   \        P                  ! V P                  V,          V P                  V,          ,          4      M^ NK_  	  up# u upi )z2RMS (root-mean-square) for each band in the image.)r   r6   mathsqrtrD   r5   s   & r   rmsStat.rms   s\    
 ZZ
 8<zz!}}DIIdiilTZZ]23!K
 	
 
s   A5AA5c                   V ^8  d   QhRR/# r9   r   )r   s   "r   r   r      s     	
 	
[ 	
r   c                :   V P                    Uu. uF  pV P                  V,          '       dc   V P                  V,          V P                  V,          R,          V P                  V,          ,          ,
          V P                  V,          ,          M^ NK  	  up# u upi )z$Variance for each band in the image.g       @)r   r6   rD   r4   r5   s   & r   varStat.var   s}     ZZ
   ::a== 1!!3tzz!} DD

STU  
 	
 
s   BA(Bc                   V ^8  d   QhRR/# r9   r   )r   s   "r   r   r      s     < < <r   c                    V P                    Uu. uF*  p\        P                  ! V P                  V,          4      NK,  	  up# u upi )z.Standard deviation for each band in the image.)r   rS   rT   rY   r5   s   & r   stddevStat.stddev   s1     15

;
1		$((1+&
;;;s   0A)r   r   )N)__name__
__module____qualname____firstlineno__r    r   r/   r6   r4   rD   rH   rO   rU   rY   r]   __static_attributes__r   r   r   r   r      s    5< H H8 N N 	 	 	 	 Y Y   
 
 	
 	
 < <r   r   )	
__future__r   rS   	functoolsr    r   r   Globalr   r   r   <module>rh      s'   . #  % E< E<P 
r   