new chi-square distance and color based energy