Autor Beitrag
Killi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 299

Win*
D6 Prof
BeitragVerfasst: Mi 03.12.03 21:42 
Hi!


Kann man 2 Images miteinander vergleichen und den Grad der Veränderung heraus"lesen" lassen?
Will ein System mit Webcam basteln, die dann ein Video aufnimmt sobald sich etwas bewegt - also, sobald ein gewisser Grad an Veränderung im Bild ist......

_________________
----
Life is hard and then you die
ixtreme
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mi 03.12.03 21:55 
du könntest jeden pixel in ein array packen und dann schauen welches pixel sich geändert hat...bei aufwärtsfolgenden zahl von pixeln kannst du das bild dann als geändert definieren...aber ob das die feine art ist?


gruß

ixtreme.de
Killi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 299

Win*
D6 Prof
BeitragVerfasst: Mi 03.12.03 21:59 
Naja, ist schonma n Anfang - aber wie mach ich das???
Wie lad ich Pixel in ein Array??? - Vor allem: sind das Zahlen, oder...?

_________________
----
Life is hard and then you die
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 04.12.03 09:27 
Hallo
gugg mal hier, villeicht hilft das weiter
www.tipps.delphi-sou.../tut20020911-8.shtml

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 04.12.03 13:05 
Hier die o. g. Lösung:
Zitat:
Wie kann ich zwei Images vergleichen?

Mit dieser Prozedur können Images pixelweise miteinander verglichen werden. Bei Images, "die mal analog waren", empfiehlt es sich möglicherweise aufgrund des Rauschanteils, mit einem Schwellenwert größer als 0 zu arbeiten. Es wird vorausgesetzt, dass die Bitmaps von image1 und image2 die gleichen Abmessungen haben!
ausblenden Delphi-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;


Gruß
Tino
Killi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 299

Win*
D6 Prof
BeitragVerfasst: Do 04.12.03 18:32 
die funktion sieht ja gut aus, aber wenn ich ein ROTES Bild habe und ein BLAU/ROTES-Bild dann sieht das Ergebnis so aus:

wenn rot beim 2.Bild auf der linken Seite dann Unterschied 0 % (!!!!!!)
wenn BLAU beim 2.Bild auf der linken Seite dann Untersch. 100 %!!!!!!!!!

Prüft er etwa nur den linken Teil des bildes - wenn da nix passiert, dann is jut oder wie???

_________________
----
Life is hard and then you die