write a matlab code to calculate the correlation coefficient for
five neighboring pixels an in an image
preferable ( 256 x 256 ) lena image
m1 = A(:,1:end-1,1); %# All rows and columns 1 through 255 n1 = A(:,2:end,1); %# All rows and columns 2 through 256 % A is the original image
randIndex1 = randperm(numel(m1)); %# A random permutation of the integers %# from 1 to numel(m1) randIndex1 = randIndex1(1:3000); %# Pick the first 3000 indices m1Rand = m1(randIndex1); %# 3000 random values from m1 n1Rand = n1(randIndex1); %# The corresponding 3000 values from n1
r_mn1 = corrcoef(m1Rand(:),n1Rand(:)); disp('r_mn1=');disp(r_mn1);
Get Answers For Free
Most questions answered within 1 hours.