I have no idea if this will work in practice but it's kinda fun. You could estimate how much a TPA represents a circle by calculating its circularity.
Circularity is basically a function of the shapes area and perimeter, which ranges from 0 to 1, with 1 being a perfect circle. E.g.,
First you would have to get the convex hull of the TPA, and then calculate the circularity of that bounding polygon. You can only keep TPAs greater than a certain circularity.
Here is an example. I included a function which converts an ATPA to an array of convexHull polygons. You will have to use the updated function by slacky because srl-6 hasnt been updated yet.
You will see one of the TPAs gets filtered out because it is less than 0.8
Simba Code:
program new;
{$i srl-6/srl.simba}
function polyArea(p: TPointArray): extended; //calc polygon area
var
i, z: Integer;
begin
z := 1;
for i := 0 to high(p) do
begin
if i >= high(p) then z := -i;
result += (p[i].x * p[i+z].y) - (p[i+z].x * p[i].y);
end;
result := abs(result /= 2);
end;
function polyPerimeter(p: TPointArray): integer; //and the perimeter
var
i, z: Integer;
begin
z := 1;
for i := 0 to high(p) do
begin
if i >= high(p) then z := -i;
result += distance(p[i], p[i+z]);
end;
end;
function circularity(p: TPointArray): extended; // calc the circularity
begin
result := 4 * pi * polyArea(p) / pow(polyPerimeter(p), 2);
end;
function T2DPointArray.filterCircularity(c: extended): T2DPointArray; // exclude TPA which are < c
var
i: Integer;
begin
for i := 0 to high(self) do
if circularity(self[i]) >= c then
insert(self[i], result, length(result));
end;
function T2DPointArray.toConvexHull(): T2DPointArray; // returns bounding points of each TPA, as an ATPA
var
i: Integer;
begin
for i := 0 to high(self) do
insert(self[i].getConvexHull(), result, length(result));
end;
var
ATPA: T2DPointArray;
begin
//Return your colours as an ATPA
//ATPA := ATPA.toConvexHull();
ATPA := [[[148, 124], [131, 133], [126, 149], [133, 165], [154, 166], [167, 150], [165, 130]], [[2, 3], [3, 3], [3, 2], [2, 2]]];
writeLn('Length ATPA before: ', length(ATPA));
ATPA := ATPA.filterCircularity(0.8);
writeLn('Length ATPA after: ', length(ATPA));;
end.