
Originally Posted by
nielsie95
cts 1 uses the average difference of RGB -> Sqrt(Sqr(R1 - R2) + Sqr(G1 - G2) + Sqr(B1 - B2))
At worst case the tolerance is Sqrt(Sqr(255) * 3) = 442.
Maybe I'm misunderstanding you, but wouldn't the "average difference" be
Code:
(Abs(R1 - R2) + Abs(G1 - G2) + Abs(B1 - B2)) / 3
Where the max would then be 255, not 442?
I don't understand how
Code:
Sqrt(Sqr(R1 - R2) + Sqr(G1 - G2) + Sqr(B1 - B2))
is an "average difference" (and, moreover, it's going to fail if (R|G|B)1 > (R|G|B)2)
Thanks for the explanation though, that did clear some things up.
[Edit]
Okay, it appears that I misread Sqr() as Sqrt(). The two functions I stated are nearly equivalent (sqrt(x^2) == |x|), but I think you misplaced some parentheses.
Was this what you intended:
Code:
Sqrt(Sqr(R1 - R2)) + Sqrt(Sqr(G1 - G2)) + Sqrt(Sqr(B1 - B2))
?
If this is the case, I still don't understand how it's the "average" (don't you have to divide by three?)
Code:
(Sqrt(Sqr(R1 - R2)) + Sqrt(Sqr(G1 - G2)) + Sqrt(Sqr(B1 - B2))) / 3
[Further edit]
I was wrong, don't listen to me.