procedure TForm1.N3Click(Sender: TObject);
var
  x,y,pos:  integer;
  temp:  array of byte;
  val:  integer;
begin
  backup();
  progressbar1.position := 0;
  setlength(temp,length(pixels));  for y := 1 to h-2 do
  begin
    for x := 3 to w*3-4 do
    begin
    pos := y*w*3+x;
    val := trunc((pixels[pos]*12 - pixels[pos-w*3-3]
     - pixels[pos-w*3] - pixels[pos-w*3+3] - pixels[pos-3]
     - pixels[pos+3] - pixels[pos-w*3-3] - pixels[pos+w*3]
     - pixels[pos+w*3+3])/4);
     if val>255 then
       temp[pos] := 255
     else if val<0 then
       temp[pos] := 0
     else
       temp[pos] := val;
    end;
    progressbar1.Position := trunc(100*y/(h-1));
  end;
    for y := 1 to h-2 do
      for x := 3 to w*3-4 do
        pixels[y*w*3+x] := temp[y*w*3+x];
  progressbar1.Position :=  0;
  updateimage();
end;
[Error] Unit1.pas(152): Undeclared identifier: 'backup'
[Error] Unit1.pas(154): Undeclared identifier: 'pixels'
[Error] Unit1.pas(156): Undeclared identifier: 'h'
[Error] Unit1.pas(158): Undeclared identifier: 'w'
[Error] Unit1.pas(178): Undeclared identifier: 'updateimage'

解决方案 »

  1.   

    backup,updateimage两个方法未定义pixels,h,w三个变量没定义你哪复制来的代码?不看上下文就复制中间一段......当然不行了
      

  2.   

    谢谢  变量我会定义  但是  backup,updateimage  如何定义?
      

  3.   

    backup(); //备份原图像updateimage(); //更新图像
      

  4.   

    这是书中一段 图片处理 的锐化原码  其中并没有backup();   //备份原图像 updateimage();   //更新图像
    这两个的定义
    实在难解  请高手告知~~