Показать сообщение отдельно
  #3  
Старый 01.06.2016, 14:25
stlcrash stlcrash вне форума
Прохожий
 
Регистрация: 27.01.2012
Сообщения: 4
Репутация: 10
По умолчанию

Код:
function Same(t1,t2:TRGBTriple):Boolean;
begin
  result := (t1.r=t2.r) and (t1.g=t2.g) and (t1.b=t2.b);
end;


//Img1-img2
procedure TForm1.FindDiff;
var x,y:integer;
  p1,p2:TRGBTriple;
  a1,a2,a3:PRGBTripleArray;
  res:TBitmap;
const
  w:TRGBTriple=(b:255;g:255;r:255);
begin
  res:=TBitmap.Create;
  res.PixelFormat := pf24bit;
  res.Width := bmp1.Width;
  res.height:=bmp1.height;
  for y:=0 to bmp1.Height-1 do
  begin
    a1:=PRGBTripleArray(bmp1.ScanLine[y]);
    a2:=PRGBTripleArray(bmp2.ScanLine[y]);
    a3:=PRGBTripleArray(res.ScanLine[y]);
    for x := 0 to bmp1.width-1 do
    begin
      p1:=a1[x];
      p2:=a2[x];
      if not same(p1,p2) then
        a3[x]:=p2
      else
        a3[x]:=w;
    end;
  end;
  img1.width:=res.Width;
  img1.Height:=res.Height;
  img1.Picture.Assign(res);
  Detect(res,((HeightWidth.Value*HeightWidth.Value) div 100)*BWPorog.Position);
  res.Free;
end;


a3[x]:=p2
Как на строке проверить входит ли p2 в указанный диапазон? rMin rMax gMin gMax bMin bMax
Ответить с цитированием