Filter löschen
Filter löschen

How to get the non-integer offset between two images

6 Ansichten (letzte 30 Tage)
Gustav Shen
Gustav Shen am 12 Mai 2017
Bearbeitet: Matt J am 12 Mai 2017
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

Akzeptierte Antwort

Matt J
Matt J am 12 Mai 2017
Bearbeitet: Matt J am 12 Mai 2017
You would probably have to use imregtform with transformType='translation'.

Weitere Antworten (0)

Kategorien

Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by