主题:请大家帮忙看看这个程序哪出错了~谢谢
程序如下:
unit SmthMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls,SmthChd;
type
TSmthform1 = class(TForm)
Button1: TButton;
Button2: TButton;
OpenDialog1: TOpenDialog;
Panel1: TPanel;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TemplateArray = array [0..7] of double;
TempAArray = array [0..19] of double;
TempBArray = array [0..19] of double;
TempUArray = array [0..17] of double;
TempMArray = array [0..13] of double;
var
oldbuf,newbuf:buf1;
winbuf:winarray;
Smthform1: TSmthform1;
CurrentFile,currentcaption:string;
Imgwidth,Imglenth:word;
ta:TemplateArray;
procedure InitTemplate();
function GetMax(ra:TemplateArray):double;
implementation
uses CommFunction;
{$R *.DFM}
procedure juanji(var oldbuf,newbuf:buf1);
var
i,j,k:Integer;
r:double;
x:Integer;
ra:TemplateArray;
filename:String;
begin
InitTemplate();
for i:=1 to 254 do
begin
for j:=1 to 254 do
begin
for k:=0 to 7 do
begin
r:=0;
r:=r+(oldbuf[i-1,j-1])*(ta[k mod 8]);
r:=r+(oldbuf[i-1,j])*(ta[(1+k) mod 8]);
r:=r+(oldbuf[i-1,j+1])*(ta[(2+k) mod 8]);
r:=r+(oldbuf[i,j+1])*(ta[(3+k) mod 8]);
r:=r+(oldbuf[i+1,j+1])*(ta[(4+k) mod 8]);
r:=r+(oldbuf[i+1,j])*(ta[(5+k) mod 8]);
r:=r+(oldbuf[i+1,j-1])*(ta[(6+k) mod 8]);
r:=r+(oldbuf[i,j-1])*(ta[(7+k) mod 8]);
ra[k]:=r;
end;
newbuf[i,j]:=Round(GetMax(ra));
end;
end;
end;
unit SmthMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls,SmthChd;
type
TSmthform1 = class(TForm)
Button1: TButton;
Button2: TButton;
OpenDialog1: TOpenDialog;
Panel1: TPanel;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TemplateArray = array [0..7] of double;
TempAArray = array [0..19] of double;
TempBArray = array [0..19] of double;
TempUArray = array [0..17] of double;
TempMArray = array [0..13] of double;
var
oldbuf,newbuf:buf1;
winbuf:winarray;
Smthform1: TSmthform1;
CurrentFile,currentcaption:string;
Imgwidth,Imglenth:word;
ta:TemplateArray;
procedure InitTemplate();
function GetMax(ra:TemplateArray):double;
implementation
uses CommFunction;
{$R *.DFM}
procedure juanji(var oldbuf,newbuf:buf1);
var
i,j,k:Integer;
r:double;
x:Integer;
ra:TemplateArray;
filename:String;
begin
InitTemplate();
for i:=1 to 254 do
begin
for j:=1 to 254 do
begin
for k:=0 to 7 do
begin
r:=0;
r:=r+(oldbuf[i-1,j-1])*(ta[k mod 8]);
r:=r+(oldbuf[i-1,j])*(ta[(1+k) mod 8]);
r:=r+(oldbuf[i-1,j+1])*(ta[(2+k) mod 8]);
r:=r+(oldbuf[i,j+1])*(ta[(3+k) mod 8]);
r:=r+(oldbuf[i+1,j+1])*(ta[(4+k) mod 8]);
r:=r+(oldbuf[i+1,j])*(ta[(5+k) mod 8]);
r:=r+(oldbuf[i+1,j-1])*(ta[(6+k) mod 8]);
r:=r+(oldbuf[i,j-1])*(ta[(7+k) mod 8]);
ra[k]:=r;
end;
newbuf[i,j]:=Round(GetMax(ra));
end;
end;
end;