Files
old-saburly-wagtail-web/env/lib/python3.10/site-packages/PIL/__pycache__/ImageStat.cpython-310.pyc

45 lines
5.6 KiB
Plaintext
Raw Normal View History

2024-08-27 20:33:44 +02:00
o
<00><><EFBFBD>f<EFBFBD><00>@sBddlmZddlZddlmZddlmZGdd<07>d<07>ZeZdS)<08>)<01> annotationsN)<01>cached_property<74>)<01>Imagec@s<>eZdZ dd dd <09>Zed!d d <0C><04>Zed"dd<0F><04>Zed#dd<12><04>Zed#dd<14><04>Zed#dd<16><04>Z ed"dd<18><04>Z
ed#dd<1A><04>Z ed#dd<1C><04>Z ed#dd<1E><04>Z dS)$<24>StatN<74> image_or_list<73>Image.Image | list[int]<5D>mask<73>Image.Image | None<6E>return<72>NonecCsTt|tj<01>r |<01>|<02>|_nt|t<04>r||_nd}t|<03><01>ttt|j<03>d<00><01>|_dS)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<73>N) <09>
isinstancer<00> histogram<61>h<>list<73> TypeError<6F>range<67>len<65>bands)<04>selfrr <00>msg<73>r<00>O/home/amir/Desktop/saburlyweb/env/lib/python3.10/site-packages/PIL/ImageStat.py<70>__init__ s 
z Stat.__init__<5F>list[tuple[int, int]]cs,d dd<06><04><00><00>fdd<08>td t<01>j<02>d
<EFBFBD>D<00>S) au
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.
r<00> list[int]r <00>tuple[int, int]cSsVd\}}td<02>D]
}||r|}nqtddd<04>D] }||r&|}||fSq||fS)N)<02><>rr r<00><><EFBFBD><EFBFBD><EFBFBD>)r)r<00>res_min<69>res_max<61>irrr<00>minmaxMs <02><02>zStat.extrema.<locals>.minmaxcsg|] }<01><00>j|d<00><00><01>qS<00>N)r<00><02>.0r"<00>r#rrr<00>
<listcomp>Ysz Stat.extrema.<locals>.<listcomp>rr N)rrr r<00>rrr<00>rrr'r<00>extrema>s
" z Stat.extremarcs <00>fdd<02>tdt<01>j<02>d<04>D<00>S)z2Total number of pixels for each band in the image.cs"g|] }t<00>j||d<00><00><01>qS)r )<02>sumrr%r*rrr(^s"zStat.count.<locals>.<listcomp>rr r)r*rr*r<00>count[s z
Stat.count<6E> list[float]cCsRg}tdt|j<02>d<02>D]}d}td<02>D] }|||j||7}q|<01>|<03>q |S)z-Sum of all pixels for each band in the image.rr <00>)rrr<00>append)r<00>vr"<00> layer_sum<75>jrrrr,`s  zStat.sumcCsZg}tdt|j<02>d<02>D]}d}td<02>D]}||dt|j||<00>7}q|<01>|<03>q |S)z5Squared sum of all pixels for each band in the image.rr r/<00>)rrr<00>floatr0)rr1r"<00>sum2r3rrrr6ls   z Stat.sum2c<01><00>fdd<02><08>jD<00>S)zAAverage (arithmetic mean) pixel level for each band in the image.cs g|] }<01>j|<00>j|<00>qSr)r,r-r%r*rrr({s zStat.mean.<locals>.<listcomp><3E>rr*rr*r<00>meanx<00>z Stat.meancCsdg}|jD]*}d}|j|d}|d}td<03>D]}||j||}||kr)nq|<01>|<06>q|S)z.Median pixel level for each band in the image.rr4r )rr-rrr0)rr1r"<00>s<>half<6C>br3rrr<00>median}s
 <02> z Stat.mediancr7)z2RMS (root-mean-square) for each band in the image.cs&g|]}t<00><01>j|<00>j|<00><01>qSr)<04>math<74>sqrtr6r-r%r*rrr(<00>s&zStat.rms.<locals>.<listcomp>r8r*rr*r<00>rms<6D>r:zStat.rmscr7)z$Variance for each band in the image.cs8g|]}<01>j|<00>j|d<00>j|<00>j|<00>qS)g@)r6r,r-r%r*rrr(<00>s*<2A><06>zStat.var.<locals>.<listcomp>r8r*rr*r<00>var<61>s
<06>zStat.varcr7)z.Standard deviation for each band in the image.csg|]
}t<00><01>j|<00><01>qSr)r?r@rBr%r*rrr(<00>szStat.stddev.<locals>.<listcomp>r8r*rr*r<00>stddev<65>r:z Stat.stddevr$)rrr r
r r )r r)r r)r r.)<0E>__name__<5F>
__module__<EFBFBD> __qualname__rrr+r-r,r6r9r>rArBrCrrrrrs* <0C>        r) <09>
__future__rr?<00> functoolsr<00>rr<00>Globalrrrr<00><module>s