Here's what I came up with, works very well
SCAR Code:
function Calibrate: Boolean;
var
P, TPA: TPointArray;
aP: T2DPointArray;
Hi, i, L, xx, yy, CTS, c1, c2: integer;
X, Y, Z: Extended;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MMCX, MMCY, P, 722182, MMX1, MMY1, MMX2, MMY2, 20);
ColorToleranceSpeed(CTS);
P := RemoveDistTPointArray(MMCX, MMCY, 76, P, True);
Hi := High(P);
if Hi < 0 then Exit;
SetLength(TPA, Hi+1);
for i := 0 to Hi do
begin
c1 := GetColor(P[i].x, P[i].y);
ColorToXYZ(c1, X, Y, Z);
if (X < 0.5) and (Y < 0.5) and (Z < 1.0) then
begin
c2 := GetColor(P[i].x+1, P[i].y);
if c1 <> c2 then
begin
ColorToXYZ(c2, X, Y, Z);
if Abs(X - Y) < 0.4 then
begin
TPA[L] := P[i];
Inc(L);
end;
end;
end;
end;
if L < 1 then Exit;
SetLength(TPA, L);
aP := SplitTPA(TPA, 15);
Hi := High(aP);
for i := 0 to Hi do
if Length(aP[i]) > 5 then
begin
MiddleTPAEx(aP[i], xx, yy);
MFNF(xx, yy, -1, 1);
Result := FFlag(0);
end;
end;