maigel
2012-01-15 07:40:00
Hi,
Recently I bumped into YoHoJo's tutorial on ACA. I instantly was like "Why the hell didn't I use this before".
So I went ahead, downloaded it and started messing with it.
Now the problem is, I'm following exactly what the tutorials says, but still I get this error atleast 95% of the times: "AutoColor failed in finding the color."
Which is called here:
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
Does anyone know what I am doing wrong?
(My CTS is set to 2)
Example function I used (and failed):
Recently I bumped into YoHoJo's tutorial on ACA. I instantly was like "Why the hell didn't I use this before".
So I went ahead, downloaded it and started messing with it.
Now the problem is, I'm following exactly what the tutorials says, but still I get this error atleast 95% of the times: "AutoColor failed in finding the color."
Which is called here:
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
Does anyone know what I am doing wrong?
(My CTS is set to 2)
Example function I used (and failed):
function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(4.17, 0.05);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 6249310, MMX1, MMY1, MMX2, MMY2, 1);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 9.94) and (X <= 10.92) and (Y >= 10.19) and (Y <= 11.20) and (Z >= 11.78) and (Z <= 12.91) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;