return r * r + g * g + b * b;
}
final int findBestMatch_KDTree(int x, int y) {
NdVector p = new NdVector(kdtree.getDimension());
int num = 0;
for (int sj = -border; sj <= 0; sj++) {
for (int si = -border; si <= border; si++) {
if ((sj == 0) && (si == 0))
break;
int tcolor = sampleTarget(x + si, y + sj);
Vector4 color = Utils.RGBAToVector4(tcolor);
p.set(num++, color.x);
p.set(num++, color.y);
p.set(num++, color.z);
}
}
FeaturePoint fp = kdtree.getNearest(p);
return fp.color;