Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to calculate the correlation of pixels of an encrypted image (for a vertical and horizontal pair of pixels). i know about the corr and used it as
RHO = corr(X)

but it's giving correlation as a matrix of correlations (i think for each and every pixel, it is showing different correlation) but i want one correlation for the whole image to compare some encrypted images, encrypted by different algorithms.

What I have tried:

i tried -
RHO = corr(image)
and
corr2(image);
but it's not working.
Posted
Updated 16-Oct-17 6:51am
v4

1 solution

My friend Ali B. says ... this way:

function r_xy=AdjancyCorrPixel( P )
x1 = double(P(:,1:end-1));
y1 = double(P(:,2:end));
randIndex1 = randperm(numel(x1));
randIndex1 = randIndex1(1:3000);
x = x1(randIndex1);
y = y1(randIndex1);
r_xy = corrcoef(x,y);
scatter(x,y);
xlabel('Pixel gray value on location (x,y)')
ylabel('Pixel gray value on location (x+1,y)')
end

(
copied & pasted from:
MATLAB Central[^]
)
 
Share this answer
 
Comments
Afzaal Ahmad Zeeshan 11-Oct-17 18:36pm    
Who is Ali B? And what does the code do exactly?

Instead of copying and pasting someone else's work, just by calling them your friend, does not work. You should post these suggestions as comments instead of answers.

I did not, but someone will downvote your post and that is a bad impact on your contributions. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900