cehua_lyf
2019-03-06 3c8ee0a8a524a6251d7d5aae2372e76fd8a99b9c
1
2
3
4
5
6
7
8
9
10
11
12
13
ŒôXc@sAddlZddlZddlZddd„ƒYZeZdS(iÿÿÿÿNtStatcBsteZdZd d„Zd„Zd„Zd„Zd„Zd„Z    d„Z
d„Z d    „Z d
„Z d „ZRS( sGet image or feature statisticscCs’y.|r|j|ƒ|_n|jƒ|_Wntk
rJ||_nXt|jƒtgƒkrrtd‚ntt|jƒdƒ|_dS(Ns$first argument must be image or listi(t    histogramthtAttributeErrorttypet    TypeErrortrangetlentbands(tselft image_or_listtmask((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt__init__/s   cCsF|d dkrt|‚nt|d|ƒƒ}t|||ƒ|S(sCalculate missing attributeit_get(Rtgetattrtsetattr(R    tidtv((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt __getattr__;s
 cCsSd„}g}x=tdt|jƒdƒD] }|j||j|ƒƒq+W|S(s-Get min/max values for each band in the imagecSsXd}d}x?tdƒD]1}||rt||ƒ}t||ƒ}qqW||fS(Niÿii(Rtmintmax(Rtntxti((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pytminmaxGs
ii(RRRtappend(R    RRR((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt _getextremaDs
        "cCsWg}xJtdt|jƒdƒD]-}|jttj|j||d!ƒƒq"W|S(s(Get total number of pixels in each layerii(RRRRtreducetoperatortadd(R    RR((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt    _getcountUs"+cCssg}xftdt|jƒdƒD]I}d}x-tdƒD]}|||j||}q;W|j|ƒq"W|S(s#Get sum of all pixels in each layeriig(RRRR(R    RRtsumtj((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt_getsum]s"cCs}g}xptdt|jƒdƒD]S}d}x7tdƒD])}||dt|j||ƒ}q;W|j|ƒq"W|S(s+Get squared sum of all pixels in each layeriigi(RRRtfloatR(R    RRtsum2R ((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt_getsum2hs"'cCs=g}x0|jD]%}|j|j||j|ƒqW|S(s&Get average pixel level for each layer(RRRtcount(R    RR((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt_getmeanss#cCsˆg}x{|jD]p}d}|j|d}|d}x9tdƒD]+}||j||}||krDPqDqDW|j|ƒqW|S(s%Get median pixel level for each layeriii(RR%RRR(R    RRtstltbR ((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt
_getmedian{s
 cCsFg}x9|jD].}|jtj|j||j|ƒƒqW|S(sGet RMS for each layer(RRtmathtsqrtR#R%(R    RR((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt_getrmsŠs,cCsVg}xI|jD]>}|j|}|j|j||j|d||ƒqW|S(sGet variance for each layerg@(RR%RR#R(R    RRR((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt_getvar“s
 /cCs;g}x.|jD]#}|jtj|j|ƒƒqW|S(s%Get standard deviation for each layer(RRR+R,tvar(R    RR((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt
_getstddevœs!N(t__name__t
__module__t__doc__tNoneR RRRR!R$R&R*R-R.R0(((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyR%s                                                       ((tImageRR+RtGlobal(((sp.\ServerPython\ZoneServerGroup\map1_8G\MapServer\MapServerData\CaptchaImage\VerificationCodePic\PIL\ImageStat.pyt<module>s