procedure TXYValues.RegionGrowing(x,y,i: integer; var image: TImage);
var c, c1, c2, c3, c4: TColor;
begin
c := image.Canvas.Pixels[x,y];
c1 := image.canvas.pixels[x+1,y];
c2 := image.Canvas.Pixels[x-1,y];
c3 := image.canvas.pixels[x,y-1];
c4 := image.canvas.pixels[x,y+1];
if form1.progressbar1.position = form1.progressbar1.max then
form1.progressbar1.position := 0;
form1.progressbar1.Position := form1.progressbar1.Position+1;
if (High(values) > x) then //muss man hier zwei if Anweisungen plazieren?
if (high(values[x]) > y) then // die zweite Abfrage soll logischerweise nur erfolgen,
begin // wenn die erste Bedingung erfüllt ist.
try
if (values[x+1,y]=0) then
if (IsAenlich(50, c, c1)) then
begin
values[x+1,y] := i;
RegionGrowing(x+1,y,i,image);
end;
except
end;
try
if (values[x-1,y]=0) then
if (IsAenlich(50, c, c2)) then
begin
values[x-1,y] := i;
RegionGrowing(x-1,y,i,image);
end;
except
end;
try
if (values[x,y-1]=0) then
if (IsAenlich(50, c, c3)) then
begin
values[x,y-1] := i;
RegionGrowing(x,y-1,i,image);
end;
except
end;
try
if (values[x,y+1]=0) then
if (IsAenlich(50, c, c4)) then
begin
values[x,y+1] := i;
RegionGrowing(x,y+1,i,image);
end;
except
end;
end;
end;
procedure TXYValues.StartRegionGrowing(image: TImage; i: integer);
begin
form1.progressbar1.min := 0;
form1.progressbar1.position := 0;
form1.progressbar1.max := 100;
RegionGrowing(leftx,lefty,i,image);
end;