AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

zwei Bitmaps vergleichen

Offene Frage von "KahPee"
Ein Thema von KahPee · begonnen am 1. Feb 2010 · letzter Beitrag vom 2. Feb 2010
Antwort Antwort
Benutzerbild von KahPee
KahPee

Registriert seit: 12. Mai 2009
214 Beiträge
 
Turbo Delphi für Win32
 
#1

Re: zwei Bitmaps vergleichen

  Alt 1. Feb 2010, 22:28
So ich habe das ganze nochmal eingehender studiert. Unten habe ich meine ursprüngliche Funktion noch mal aufgegriffen und versucht anzupassen. Allerdings will das nocht nicht so wie ich will . Wie gebe ich die x-koordinate für den Pixel an? Mein Gefühl sagt, mir das ich nur 2-3 Zeilen von der Lösung weg bin. Aber ich hoffe ich täusche micht nicht . Es wäre nett wenn mir da nochmal auf die Sprünge geholfen werden könnte.

Delphi-Quellcode:
function Bitmapcompare(pic1, pic2: Tbitmap; Posx,posy: Integer): Boolean;
var
  Pix1, Pix2 : PByte;
  y, k, x : Integer;
  bytes : Byte;
  compix, matchpix: integer;
const
  PixelFormatBytes: Array[TPixelFormat] of Byte = ( 0, 0, 0, 1, 0, 2, 3, 4, 0 );
begin
  result:=false;
  bytes1 := PixelFormatBytes[pic1.PixelFormat];
  bytes2 := PixelFormatBytes[pic2.PixelFormat];
  
  if (bytes1 = 0) or (bytes2=0) then
    Exit; // PixelFormat wird nicht unterstützt ... kannst du dann gerne von mir aus umändern ...
  for y := 0 to pic2.Height - 1 do
  begin
    Pix1 := pic1.Scanline[posy+y];
    Pix2 := pic2.Scanline[y];
    for x := 0 to pic2.Width - 1 do
      for k := 0 to bytes2 - 1 do
      begin
    //VERGLEICH
        if pix1=pix2 then inc(matchpix); //x-Koordinate nicht berücksichtigt
    
        Pix1^ := 0;
        inc(Pix1);
        Pix2^ :=0;
        inc(pix2);
      
        inc(compix);
      end;
  end;

   if compix=matchpix then Result:=true;
end;
Übrigens vielen Dank für den Hinweis mit "Inc()", das dürfte mir in Zukunft ein wenig Tipparbeit ersparen

schon mal Vielen Dank

KahPee
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:07 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz