how can I make 2d auto-correlation and 2d cross-correlation for images dataset

조회 수: 4 (최근 30일)
Suheer Ali
Suheer Ali 2018년 3월 23일
댓글: Image Analyst 2018년 3월 26일
I want to classify an image based on 1. make 2D auto-correlation for a dataset 2. then make 2D cross-correlation for the same dataset with an image to measure the similrity. 3. Ater that find the MSE between 2D auto-correlation and 2D cross-correlation. 4. classify the image to the class get the minimum Mean square error (MSE) if true % code
%the normalized 2-D cross-correlation
trainedIamge = gpuArray(Final) %Final is binary image
testImage = gpuArray(Final1) %Final1 is binary image
c1 = normxcorr2(trainedIamge,testImage);
%figure, surf(c), shading flat
[ypeak, xpeak] = find(c==max(c(:)))
c2 = normxcorr2(trainedIamge,trainedIamge); % I don't know how I make it Auto correlation
%figure, surf(c), shading flat
end
I used the following code for finding MSE between 2D auto-correlation and 2D cross-correlation but it gave me an error.
if true
% code
err = immse(mat2gray(c1),mat2gray(c2))
end
I converted c1 and c2 onto grayscale images because it gave an error about the datatypes. the above code is for one image. Do I have to make a loop for a dataset or there is a specific method?
thanks

답변 (1개)

Image Analyst
Image Analyst 2018년 3월 23일
Yes you need to have a loop. See the FAQ for code examples: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
  댓글 수: 2
Suheer Ali
Suheer Ali 2018년 3월 25일
thanks for your answer. my question here is about finding the mse error between autocorrelation and cross correlation. how can I do it? and using using
if true
c2 = normxcorr2(trainedIamge,trainedIamge);
end
is it true for auto-correlation?
Image Analyst
Image Analyst 2018년 3월 26일
That is the autocorrelation. But it's normalized. You can use xcorr2(). Then use immse() to get the mean square error.

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

Community Treasure Hunt

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

Start Hunting!

Translated by