unit DiffBild;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ dieses ist eine Komponente
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
interface
uses
Windows, SysUtils, Classes, Controls, ExtCtrls, Graphics, EB_Mathe;
type
TDiffMat =record
PixHeight : integer;
PixWidth : integer;
PixSize : single;
SizeHeight : single;
SizeWidth : single;
Dat : TMatrix;
//array of array of single;
rangeMat :
array of array of boolean;
end;
TDiffBild =
class(TPaintBox)
private
Pix : integer;
wSize, hSize : single;
cF : integer;
protected
public
Plan : TDiffMat;
Film : TDiffMat;
Diff : TDiffMat;
globDiff : TDiffMat;
lokDiff : TDiffMat;
globGamma: TDiffMat;
lokGamma : TDiffMat;
fs:
array[0..17]
of TFarbScala;
pMax : single;
fMax : single;
published
procedure Initialisieren(PixWeit,PixHoch : integer; SizeWeit, SizeHoch, PixSize:single);
procedure Bild(vx,vy:integer;Schwelle:single);
procedure globDiffBild(vx,vy:integer;Schwelle:single);
procedure lokDiffBild(vx,vy:integer;Schwelle:single);
end;
procedure Register;
//##############################################################################
implementation
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure TDiffBild.Initialisieren(PixWeit,PixHoch : integer; SizeWeit, SizeHoch, PixSize:single);
var
i : integer;
zwischen : single;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
begin // hier werden alle Matrixgrößen festgelegt
Plan.PixHeight := PixHoch;
Plan.PixWidth := PixWeit;
Plan.PixSize := PixSize;
Plan.SizeHeight:= SizeHoch;
Plan.SizeWidth := SizeWeit;
SetLength(Plan.Dat,PixWeit+3,PixHoch+3);
Film.PixHeight := PixHoch;
Film.PixWidth := PixWeit;
Film.PixSize := PixSize;
Film.SizeHeight:= SizeHoch;
Film.SizeWidth := SizeWeit;
SetLength(Film.Dat,PixWeit+3,PixHoch+3);
// Pixelgröße und Pixellage bestimmen
PixSize:=(SizeWeit/PixWeit+SizeHoch/PixHoch)/2;
Film.PixSize :=PixSize;
cF := 1 + 256 + 256*256;
SetLength(Diff.Dat,PixWeit+3,PixHoch+3);
SetLength(globDiff.Dat,PixWeit+3,PixHoch+3);
SetLength(lokDiff.Dat,PixWeit+3,PixHoch+3);
end;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure TDiffBild.Bild(vx,vy:integer;Schwelle:single);
var
i, j, k : integer;
Maximum : single;
zwischen : single;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
begin
canvas.Pen.Mode:=pmCopy;
// BildMalen
for j := 1
to Film.PixHeight
do // ** hier haben alle Variablen noch ihren Wert
begin
for i := 1
to Film.PixWidth
do
begin
Diff.Dat[i,j]:=Film.Dat[i-vx,j-vy]- Plan.Dat[i-vx,j-vy];
Canvas.Pixels[i,j]:=Diff.Dat[i,j];
end;
end;
end;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure TDiffBild.globDiffBild(vx,vy:integer;Schwelle:single);
var
i, j, k : integer;
Maximum : single;
zwischen : single;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
begin
canvas.Pen.Mode:=pmCopy;
// BildMalen
for j := 1
to Film.PixHeight
do // ** und hier haben Film.PixHeight, Plan.Dat[i,j] ...
begin // ** KEINEN Wert mehr!
for i := 1
to Film.PixWidth
do
begin
globDiff.Dat[i,j]:=Film.Dat[i-vx,j-vy] - Plan.Dat[i,j];
Canvas.Pixels[i,j]:=globDiff.Dat[i,j];
end;
end;
end;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure Register;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
begin
RegisterComponents('
EB_Graph', [TDiffBild]);
end;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
end.