SRL Archive - Help and Support

Need Help with TPA


Claymore

2011-12-29 00:12:05


SetArrayLength(ATPA, Length(Colors));
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
for i := 0 to High(Colors) do
begin
SetColorSpeed2Modifiers(Hue[i], Sat[i]);
FindColorsSpiralTolerance(MSCX, MSCY, ATPA[i], Colors[i], x1, y1, x2, y2, Tol[i]);
end;

for i := 0 to High(ATPA) do

So after i do that, i want to remove a TPA for each ATPA that does not meet the min length.

Or if not remove, i want to make a new TPA that has met the required length from the old TPA.

Anyway to do that? Im sorry i cant explain my intentions very well as i have a very crude idea of how TPAs actually work and i can only visualize what it does.

RISK

2011-12-29 00:15:42

if (Length(TPA_Name) < 10) then 
Continue;

Make a for .. to .. do loop and if the length is less than 10 pixels, it will go to the next TPA. ATPA, by the way if you want to get the TPA from an ATPA.
That's the closest I can imagine to what you want to do.

Claymore

2011-12-29 00:18:06

Ok i got that part down.

Ok heres my function.


SetArrayLength(ATPA, Length(Colors));
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
for i := 0 to High(Colors) do
begin
SetColorSpeed2Modifiers(Hue[i], Sat[i]);
FindColorsSpiralTolerance(MSCX, MSCY, ATPA[i], Colors[i], x1, y1, x2, y2, Tol[i]);
end;

for i := 0 to High(ATPA) do
if Length(ATPA[i]) < 25 then
DeleteValueInTPA(ATPA[i], i);


SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);

TPA := MergeATPA(ATPA);
ATPA := TPAtoATPAEx(TPA, Width, Height);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
if Length(ATPA) = 0 then
Exit;

What im trying to do is remove the unexceptional TPAs from finding the colors before merging the TPAs.

However i dont know what im doing ???? :/

euphemism

2011-12-29 00:20:15

I think something like this will do it:


SetLength(ATPA, Length(Colors));

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);

for i := 0 to High(Colors) do
begin

SetColorSpeed2Modifiers(Hue[i], Sat[i]);
FindColorsSpiralTolerance(MSCX, MSCY, ATPA[i], Colors[i], x1, y1, x2, y2, Tol[i]);
end;

for i := 0 to High(ATPA) do
if (Length(ATPA[i]) < MinCount) then
DeleteValueInATPA(ATPA, i);

Claymore

2011-12-29 00:22:41

Ah thanks, that should work.