Re: find largest cluster?



mauro wrote:
On Apr 10, 2:22 am, bugbear <bugbear@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I need "near" values; so the packed-sorting thing won't
do what I want.

so, your problem is not actually finding the largest cluster of "near"
colour (it would be easy), it is defining what "near" is. Working only
on colours it won't help, you should use some pattern recognition.

As a first approximation, I'd define the distance
between 2 RGB values as the linear distance
in 3D (RGB) space, with each dimension scaled
as per the usual (NTSC) conversion from RGB to grayscale.

gray = .3 * red + .59 * green + .11 * blue.

Thus distance = sqrt((.3 * delta(R))^2 + (.59 * delta(G))^2 + (.11 * delta (B))^2);

and if one is only doing comparisions, one can omit the sqrt.

BugBear
.