Fórum como comparar se duas imagens são iguais #225497
12/04/2004
0
if ImageCopiaImage1.Picture.Graphic <> ImageCopiaAntImage1.Picture.Graphic then .....
mas não deu certo.
Alguém pode me ajudar?
Angelluiza
Curtir tópico
+ 0Posts
12/04/2004
Balceiro
Ai o delphi leria o conteúdo do arquivo e analizaria se os dois conteúdos são iguais.
Gostei + 0
12/04/2004
Angelluiza
mas como o delphi vai ler o conteúdo do arquivo e analizar se os dois conteúdos são iguais?
Gostei + 0
12/04/2004
Akelle Kara
function CompararImgs(Image1, Image2: TImage): Boolean; var b1, b2: TBitmap; c1, c2: PByte; x, y, i, different, BytesPerPixel: Integer; begin b1 := Image1.Picture.Bitmap; b2 := Image2.Picture.Bitmap; Assert(b1.PixelFormat = b2.PixelFormat); different := 0; case b1.PixelFormat of pf1bit, pf4bit, pf8bit: BytesPerPixel := 1; pf15bit, pf16bit: BytesPerPixel := 2; pf24bit: BytesPerPixel := 3; pf32bit: BytesPerPixel := 4; end; for y := 0 to b1.Height - 1 do begin c1 := b1.Scanline[y]; c2 := b2.Scanline[y]; for x := 0 to b1.Width - 1 do for i := 0 to BytesPerPixel - 1 do begin Inc(different, Integer(c1^ <> c2^)); Inc(c1); Inc(c2); end; end; Result := (different <> 0); end;
Qualquer dúvida, pode deixar uma msg como resposta a este tópico.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)