clear all; close all; %ako posunut obrazok a potom pomocou korelacie zistit posun? obr= imread('wpeppers.jpg'); image(obr); axis equal ; figure('name','GRAYed'); colormap(gray(256)); obrg=rgb2gray(obr); image(obrg); axis equal; figure('name','Nie Posun'); colormap(gray(256)); posRow=10 posCol=5 OP=obrg(posRow+1:end,posCol+1:end); ONP=obrg(1:(512-posRow),1:(512-posCol)); image(ONP); axis equal; figure('name','Posun'); colormap(gray(256)); image(OP); axis equal; figure('name','Autokorelacia neposunuteho') ; colormap(gray(256)); AC=xcorr2(ONP,ONP); max_AC=max(max(abs(AC))); [ACI_ROW,ACI_COL]=find(AC==max_AC) LAC=AC*255.0/max_AC; image(LAC); axis equal; figure('name','Korelacia s posunutym') ; colormap(gray(256)); CC=xcorr2(ONP,OP); max_CC=max(max(abs(CC))); [CCI_ROW,CCI_COL]=find(CC==max_CC) LCC=CC*255.0/max_CC; image(LCC); axis equal; figure('name','Detail rozdielu') ; colormap(gray(256)); DLT=abs(CC-AC); max_DLT=max(max(abs(DLT))); LDLT=DLT*255.0/max_DLT; image(LDLT(490:520,490:520)); axis equal