How to get the non-integer offset between two images

6 次查看(过去 30 天)
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

采纳的回答

Matt J
Matt J 2017-5-12
编辑:Matt J 2017-5-12
You would probably have to use imregtform with transformType='translation'.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by