Azzera filtri
Azzera filtri

How to get the non-integer offset between two images

6 visualizzazioni (ultimi 30 giorni)
I use 'normxcorr2' to define the offset between the template and images, but if the offset less than 0.5 pixels, I got the result is '0', and I want the exact value, such as '0.35 pixels'.
That's the offset, there are 10 images, row1 is x-direction, row2 is y-direction, the first image is the template. Those '0' in the table might be '0.1' or '0.34'....how can I use interpolation to get the exact value? or any other methods. Thanks in advance.
my code is that:
for k=1: Scan_Range
template = imcrop(Array_Sample(:,:,1),[400 400 99 99]);
subimage(:,:,k) = imcrop(Array_Sample(:,:,k),[400 400 99 99]);
C = normxcorr2(template,subimage(:,:,k));
[max_cc,imax] = max(abs(C(:)));
[ypeak, xpeak] = ind2sub(size(C),imax(1));
offset(:,k) = [(ypeak-size(subimage,2)),(xpeak-size(subimage,1))];
end

Risposta accettata

Matt J
Matt J il 12 Mag 2017
Modificato: Matt J il 12 Mag 2017
You would probably have to use imregtform with transformType='translation'.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by