(Вот что бывает если использовать код написанный не понятно по какой формуле и методике )
Код: Выделить всё
// Гистерезисный порог
procedure HTBase( Tmin,TMax:Integer);
var
i,j:Integer;
LL,CY:Integer;
h,w,C,C1,c2:Integer;
// Реализация в 4 прохода с частичной потерью точности.
begin
w:=GetWidth(1);
H:=GetHeight(1);
CY:=0;
for i:=1 to W-1 do
begin
if BWColor(GetPixel(1,i,Cy))> Tmin then SetPixel(0,i,cy,RGB($80,0,0));
if ( BWColor(GetPixel(1,i,Cy))> Tmax) or ( BWColor(GetPixel(1,i-1,Cy))=255) then SetPixel(1,i,cy,RGB(255,0,0));
RunTime (W,i );
end;
for j:=1 to H-1 do
for i:=1 to W-1 do
begin
C:= GetPixel(1,i,J);
C1:= GetPixel(1,i-1,J);
c2:= GetPixel(1,i,J-1);
SetPixel(1,i,j,RGB(0,Green(C),Blue(C)));
RunTime (W,i );
// Уже тут четко видно что картинка просто обнулятся...
if ( BWColor(C)> Tmin) then
begin
SetPixel(1,i,j,RGB($80,Green(C),Blue(C) ));
if (BWColor(C1)=255) or (red(c2)=255) then SetPixel(1,i,j,RGB(255,Green(C),Blue(C)));
end;
if (BWColor(C)> Tmax) then SetPixel(1,i,j,RGB(255,Green(C),Blue(C)));
end;
// Обратный проход
for i:=W-2 downto 0 do
begin
C:= GetPixel(1,i,H-1);
C2:= red(GetPixel(1,i+1,H-1));
C1:= BWColor(C);
if (red(C)= $80) and (c2=255) then SetPixel(1,i,h-1,RGB(255,Green(C),Blue(C)));
end;
for j:=h-2 downto 0 do
for i:=W-2 downto 0 do
begin
C:= GetPixel(1,i,j);
C2:= red(GetPixel(1,i,j+1));
C1:= red(GetPixel(1+1,i,j+1));
if (Red(c)= $80) and ((c1=255) or (c2=255)) then SetPixel(1,i,j,RGB(255,Green(C),Blue(C)));
if (red(C) > $80) then SetPixel(1,i,j,RGB(0,Green(C),Blue(C)));
end;
// 3 проход
for i:=1 to W-1 do
begin
C:= GetPixel(1,i,0);
C2:= red(GetPixel(1,i+1,0));
C1:= BWColor(C);
if (red(C) > $80) and (c2=255) then SetPixel(1,i,j,RGB(0,Green(C),Blue(C)));
end;
for j:=1 to H-1 do
for i:=1 to W-1 do
begin
C:= GetPixel(1,i,j);
C2:= red(GetPixel(1,i,j+1));
C1:= red(GetPixel(1+1,i,j+1));
if (red(c)= $80) and ( (c1=255) or (c2=255) ) then SetPixel(1,i,j,RGB(255,Green(C),Blue(C)));
end;
// 4 проход
// Обратный проход 2
for i:=W-2 downto 0 do
begin
C:= GetPixel(1,i,0);
C2:= red(GetPixel(1,i+1,0));
C1:= BWColor(C);
if (red(C) > $80) and (c2=255)then SetPixel(1,i,j,RGB(0,Green(C),Blue(C)));
end;
for j:=H-2 downto 0 do
for i:=W-2 downto 0 do
begin
C:= GetPixel(1,i,j);
C2:= red(GetPixel(1,i,j+1));
C1:= red(GetPixel(1+1,i,j+1));
if (red(c)= $80) and ((c1=255) or (c2=255)) then SetPixel(1,i,j,RGB(255,Green(C),Blue(C)));
if (red(C) > $80) then SetPixel(1,i,j,RGB(0,Green(C),Blue(C)));
end;
end;
LH,LL:Integer;
begin
//Lh:= StrToInt(GetParam('L_HI'));
//LL:= StrToInt(GetParam('L_L'));
CopyImage(0,1);
RunTime (H,1 );
HTBase (100,200);
RunTime (H,1 );
MSG('script run...');
end.