Witam
Zmieniając tablice z statycznej na dynamiczną po kompilacji programu wyskakuje mi access violation.
Oto istotna część kodu:
Zmienna globalna
AcumulatorTab : array of array of array of integer;
Procedura z wykorzystaną tablicą:
procedure HoughCirceTransform(current_img:integer; RadiusTab:array of byte);
var H,V,R,i,angle:integer;
x0,y0,x,y:integer;
t:real;
begin
SetLength(AcumulatorTab, High(RadiusTab),BitmapOrgTab[1].Width, BitmapOrgTab[1].Height);
x:=0; y:=0;
for i:=0 to High(RadiusTab) do
begin
R:=RadiusTab[i];
AcumulatorTab.radius:=R;
for V:=0 to BitmapOrgTab[current_img].Height-1 do
for H:=0 to BitmapOrgTab[current_img].Width-1 do
if BitmapResTab[current_img].CordTab[H,V].pixel=0 then
for angle:=0 to 360 do
begin
t:=(angle*pi)/180;
x0:=round(x-(R)*cos(t));
y0:=round(y-(R)*sin(t));
if (x0>=0)and(y0>=0)and(x0<=BitmapOrgTab[current_img].Width-1)and(y0<=BitmapOrgTab[current_img].Height-1) then
AcumulatorTab[R,x0,y0]:= AcumulatorTab[R,x0,y0] + 1;
x:=H; y:=V;
end;
end;
AcumulatorTab:=Nil;
end;
I na koniec wywołanie procedury:
procedure TForm1.HoughTransform1Click(Sender: TObject);
var i:integer;
RadTab: array [0..0] of byte;
begin
RadTab[0]:=15;
HoughCirceTransform(1,RadTab[0]);
end;
Czy ktoś orientuje się gdzie może znajdować się problem? Zmieniając tablicę dynamiczną na statyczną wszystko kompiluje się i działa poprawnie.