Image segmentation

E(R)=sR(ysμR)2

with

(ysμR)2=ys22ysmyR+μR2

=>

sR(ysμR)2=sRys22sRysmyR+sRμR2=area_square_sum2meanarea+mean2area