
Benim sormak istediğim de digital foroğraf makinaları ile panoromik çekim modu ile ardışık şekilde çekilen fotoğrafların belli programlarla ortak noktalarının bulunup birleştirilmesi.. Bu konuda bilgisi olup da paylaşmak isteyen var mı


Kenar bulmak olayını ben farklı iki resimdeki ortak kenarlar olarak anlıyorum. O yüzden @Opt2000 ın söylediği histogramların karşılaştırılması da sanırım böyle bir yöntem..?bk yazdı:anladığım kadarıyla kenar bulmaya gerek yok Opt2000 3. söylediği işini görürBenim sormak istediğim de digital foroğraf makinaları ile panoromik çekim modu ile ardışık şekilde çekilen fotoğrafların belli programlarla ortak noktalarının bulunup birleştirilmesi..
Kod: Tümünü seç
function TForm1.AnalysisImage2(Img1, Img2: TBitmap; RefRect: TRect): TRect;
var
I,J:integer;
Sum1:DynamicArray;
Sum2:DynamicArray;
K,L:integer;
AWidth,AHeight:integer;
Tolerance:integer;
begin
SetLength(Sum1,(RefRect.Right - RefRect.Left));
SetLength(Sum2,(RefRect.Right - RefRect.Left));
for I:=RefRect.Left to RefRect.Right-1 do
begin
SetLength(Sum1[I - RefRect.Left],(RefRect.Bottom - RefRect.Top));
SetLength(Sum2[I - RefRect.Left],(RefRect.Bottom - RefRect.Top));
end;
lblInfo.Caption:='Analysing first image...';
Application.ProcessMessages;
J:=RefRect.Top;
while (J<RefRect.Bottom) do
begin
I:=RefRect.Left;
While (I<RefRect.Right) do
begin
Sum1[(I - RefRect.Left) div Chunk,(J-RefRect.Top) div Chunk]:=GetSum(Img1,Rect(I,J,I + Chunk,J + Chunk));
Inc(I,Chunk);
end;
Inc(J,Chunk);
end;
lblInfo.Caption:='Analysing second image...';
Application.ProcessMessages;
AWidth:=RefRect.Right - RefRect.Left;
AHeight:=RefRect.Bottom - RefRect.Top;
Tolerance:=StrToInt(txtTolerance.Text) * 3 * Chunk * Chunk;
pbProgress.Max:=Img2.Width-AWidth-Chunk-1;
for I:=0 to Img2.Width-AWidth-Chunk-1 do
begin
for J:=0 to Img2.Height-AHeight-Chunk-1 do
begin
L:=J;
while (L<J + AHeight)do
begin
K:=I;
while(K<I + AWidth) do
begin
Sum2[(K - I)div Chunk,(L - J) div Chunk]:=GetSum(Img2,Rect(K,L,K + Chunk,L + Chunk));
Inc(K,Chunk);
end;
Inc(L,Chunk);
end;
if AreArraysEqueal(Sum1,Sum2,Tolerance) then
begin
Result:=Rect(I,J,I + AWidth,J + AHeight);
lblInfo.Caption:='';
pbProgress.Position:=0;
Exit;
end;
end;
pbProgress.StepIt;
end;
pbProgress.Position:=0;
lblInfo.Caption:='';
Application.ProcessMessages;
Result:=Rect(-1,-1,-1,-1);
end;
function TForm1.GetSum(Img: TBitmap;ARect:TRect): integer;
var
I:integer;
J:integer;
ScanLine:PByteArray;
begin
Result:=0;
for J:=ARect.Top to ARect.Bottom do
begin
ScanLine:=Img.ScanLine[J];
I:=ARect.Left * 3;
while (I<ARect.Right * 3) do
begin
Result:=Result + ScanLine[I];
Inc(I,1);
end;
end;
end;
function TForm1.AreArraysEqueal(BaseList, SearchList: DynamicArray;
Tolerance:integer): boolean;
var
I,J:integer;
begin
for I:=Low(BaseList) to High(BaseList) div Chunk -1 do
begin
for J:=Low(BaseList[I]) to High(BaseList[I]) div Chunk-1 do
begin
if not InRange(SearchList[I,J],BaseList[I,J] - Tolerance,BaseList[I,J] + Tolerance) then
begin
Result:=false;
Exit;
end;
end;
end;
Result:=true;
end;