How to match multiple images to one reference image using cross correlation?

I have an image sequence containing 180 sequential images. I would like to match the images, one by one, to the first frame i.e. the first image of the data set is the reference image, the second one becomes the template which I would match to the reference successfully and then match the third to the previously obtained matched images, so on and so forth. I'm trying to do this using cross correlation but I can't seem to understand how to. Any help would be appreciated.

답변 (2개)

Vidya Viswanathan
Vidya Viswanathan 2016년 3월 31일
Hi,
My understanding is that you would like to find matching features between two images and then apply some geometric transformation on the two images based on the matching features to perform image registration. There are a couple of functions available with Image Processing Toolbox that would help you. The following documentation page talks about Image Registration:
You would have to first detect the features using one of the feature extraction techniques listed and then perform feature matching to determine the corresponding features. Once the matched features are extracted, you could estimate and apply some geometric transformation to match the images. I hope this answers your question.
Regards,
Vidya
Image Analyst
Image Analyst 2016년 3월 31일
See my attached demo on normxcorr2.
You might also look into imregister().

댓글 수: 4

Dear Image Analyst, I have already gone through and tried your demo file, which didn't work well for me. I'm using phase correlation to obtain displacement between my images The template used is the cropped rectangular box containing the pre-processed data. The displacement is represented as the Kronecker delta function and to obtain point of registration, I take the phase correlogram, obtain the x and y coordinates of the peak.
It's a little hard for us to visualize what you're talking about. Can you include screenshots, m-files, or anything to help us help you? Right now you're making us guess pretty much blindly.
[row1,col1] = find(im); % im is the preprocessed image I pass into my function x1 = min(col1); y1 = min(row1); x2 = max(col1)-x1; y2 = max(row1)-y1; template = imcrop(im, [x1 y1 x2 y2]); %this part of the code finds a rectangular box, encasing the region which begins at the first occurrence of 1, in both x and y direction in the preprocessed (binary) image
%% calculate padding bx = size(background,2); by = size(background,1); tx = size(template,2); ty = size(template,1);
%% fft %Compute the cross power spectrum using phase correlation Ga = fft2(background); Gb = fft2(template, by, bx); %to produce a result of dimensions of background c = real(ifft2((Ga.*conj(Gb))./abs(Ga.*conj(Gb)))); %.* signifies Hadamard product (array multiplication)
%% find peak correlation, and hence point of registeration [max_c, imax] = max(abs(c(:))); %find point of registration [row,col] = ind2sub(size(c), imax); display best match hFig = figure; hAx = axes;
% position the rectangular template size on background image position = [row(1), col(1), tx, ty]; imshow(background, 'Parent', hAx); abc = imrect(hAx, position);
Please give us running code, not this:
Undefined function or variable 'im'.
Error in test3 (line 1)
[row1,col1] = find(im); % im is the preprocessed image I pass into my function
If you can demo your problem with a standard demo image like cameraman.tif, then please do so. If I did that, I get this:
Undefined function or variable 'background'.
Error in test3 (line 10)
bx = size(background,2);
Two strikes and you're out. I gave up after this.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

질문:

2016년 3월 21일

댓글:

2016년 4월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by