Я подозреваю, что это дико неэффективно, но является вполне простым подходом, который работал над небольшим набором данных, что я примерил его.
select top 1 field
from table
where field in (select top 5 field from table order by field asc)
order by field desc
Это получило бы 5-й объект, изменило бы второе главное число для получения различного энного объекта
SQL-сервер только (я думаю), но должен работать над более старыми версиями, которые не поддерживают ROW_NUMBER ().
Convert all of the colors to the CIE Lab color space and compute the distance in that space
deltaE = sqrt(deltaL^2 + deltaA^2 + deltaB^2)
Colors with the lowest deltaE are the most perceptually similar to each other.
No, you do not need neural networks here! Simply consider an HSL color value a vector and define a weighted modulus function for the vector like this:
modulus = sqrt(a*H1*H1 + b*S1*S1 + c*L1*L1);
where a,b,c are weights you should decide based on your visual definition of what
creates a bigger difference in perceived color - a 1% change in Hue or a 1%
change in Saturation
I would suggest you use a = b = 0.5 and c = 1
Finally, find out the range your modulus would take and define similar colors to be those which have their moduli very close to each other (say 5%)
I'd also point out the least squares method, just as something slightly simpler. That is, you take the difference of a number, square it, then sum all these squared differences.