Autor Beitrag
jensenwb
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36



BeitragVerfasst: Sa 28.12.02 15:47 
Wie kann ich 2 Bilder miteinander auf Gleichheit oder Unterschiede vergleichen?
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Sa 28.12.02 16:43 
Such mal hier nach dem Tip: "zwei Bitmaps auf Gleichheit prüfen"

home.pages.at/dbr-software/delphi/
Mari
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54



BeitragVerfasst: Sa 28.12.02 17:24 
Was willst du überhaupt vergleichen? Ob es sich zweimal um das gleiche Bild handelt oder welche Pixel sich bei den zwei Bildern unterscheiden?
jensenwb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36



BeitragVerfasst: Sa 28.12.02 18:22 
Ich möchte ein Programm schreiben welche in einen bestimmten abstand ein screenshot von einen bestimmten bereich macht und dann mit einer vorlage auf irgendwelche unterschiede vergleichen.

Das Bedeutet das ich eine Screenshot mit einem von mir vorgegebenen Bild auf Gleichheit überprüfe.
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: Mi 01.01.03 19:52 
also ich hab mal diese procedure irgendwo gelesen:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
procedure CompareImages(Image1, Image2: TImage);
var x, y: integer;
  anzahl_unterschiede: LongInt;
  zeile1, zeile2: PByteArray;
  prozent: single;
const schwellenwert=5;
  // Erst wenn die Unterschiede den Schwellenwert überschreiten,
  // wird die Abweichung registriert.
begin
  anzahl_unterschiede:=0;
  for y:=0 to image1.Picture.Bitmap.height-1 do begin
    zeile1:=image1.Picture.Bitmap.scanline[y];
    zeile2:=image2.Picture.Bitmap.scanline[y];
    for x:=0 to image1.Picture.Bitmap.width-1 do
      if abs(zeile1[x]-zeile2[x])>schwellenwert then
        inc(anzahl_unterschiede);
    if image1.Picture.Bitmap.height*image1.Picture.Bitmap.width>0 then
      prozent:=100*(anzahl_unterschiede/(image1.Picture.Bitmap.height*
      image1.Picture.Bitmap.width))
    else
      prozent:=0;
    label1.caption:='Unterschiede:'+FloatToStr(prozent)+'%';
  end;
end;


allerdings müssen da die bitmaps gleichgroß sein, doch bei screenshots ist dies ja der fall, wenn man nicht die auflösung d. bildschirms ändert