J4GXXT5TT6X7Y72ZBDX5WRWH5DHRYX2LLKYN77XMHOQXUJMBHWBAC
DAO6H35AWHIN7CU6O2MYC22CQCR4QEBYYJ2G6S3PMZY7ZWYOUVNAC
V4Y4VDGOEIFGEXKAWUHZUD3DIRRMDYK3YKONXMOX2PRSM53ZARFAC
ACSSNXV42QLP5AJPQF5ZQJAC2BTIZULX3543SDQAJJT4LBETYF7AC
RSWQPKYWMLVXPFAGSCLBEKSXR2VMBHQDWCHTZ3DNILL475H7MHTQC
XS23G2AJ3RR2VKQYNQT7XD7BV2ZA5OFDA2HCN7S6W4ZDMIL72EEQC
OYLAFIHLW6O3VBMJHWRJM4QS5VEA2UJXLLTSHUEELUMYUA5L3NJAC
FC3AQ3RJC4ITEH3CK7FAKAZ4GRRYRX5VC624BRZC6MRLLO5RCTSQC
r = weighted_average(hist[:256])
g = weighted_average(hist[256:512])
b = weighted_average(hist[512:768])
return (r, g, b)
r, re = weighted_average(hist[:256])
g, ge = weighted_average(hist[256:512])
b, be = weighted_average(hist[512:768])
e = re * 0.2989 + ge * 0.5870 + be * 0.1140
return (r, g, b), e
def component_error(hist, value):
count = sum(x * (value - i) ** 2 for i, x in enumerate(hist))
total = sum(hist)
return (count / total) ** 0.5
def error(hist, color):
r = component_error(hist[:256], color[0])
g = component_error(hist[256:512], color[1])
b = component_error(hist[512:768], color[2])
return r * 0.2989 + g * 0.5870 + b * 0.1140