How to calculate horizontal and vertical correlation of an image in matlab???

11 次查看(过去 30 天)
  • How to calculate horizontal and vertical correlation of an image in matlab???
  1 个评论
Hyderkkk
Hyderkkk 2021-9-26
IA=rgb2gray(im2double(orginal ));
c_diag = corrcoef(IA(1:end-1, 1:end-1), IA(2:end, 2:end));
c_vert = corrcoef(IA(1:end-1, :), IA(2:end, :));
c_horz = corrcoef(IA(:, 1:end-1, :), IA(:, 2:end));
figure;
subplot(3,3,1)
plot(IA(1:end-1, 1:end-1), IA(2:end, 2:end),'b'),title(sprintf('%s Horizontal Orginal image',b));
subplot(3,3,2)
plot(IA(1:end-1, :), IA(2:end, :),'b'),title(sprintf('%s Vertical Orginal image',b));
subplot(3,3,3)
plot(IA(:, 1:end-1, :), IA(:, 2:end),'b'),title(sprintf('%s Diagonal Orginal image',b));
IAA=rgb2gray(im2double(encrption));
c_diage = corrcoef(IAA(1:end-1, 1:end-1), IAA(2:end, 2:end))
c_verte = corrcoef(IAA(1:end-1, :), IAA(2:end, :))
c_horze = corrcoef(IAA(:, 1:end-1, :), IAA(:, 2:end))
subplot(3,3,4)
plot(IAA(1:end-1, 1:end-1), IAA(2:end, 2:end),'r'),title(sprintf('%s Horizontal chiphered image ',b));
subplot(3,3,5)
plot(IAA(1:end-1, :), IA(2:end, :),'r'),title(sprintf('%s Vertical chiphered image',b));
subplot(3,3,6)
plot(IAA(:, 1:end-1, :), IA(:, 2:end),'r'),title(sprintf('%s Diagonal chiphered image',b));

请先登录,再进行评论。

回答(3 个)

elhabib
elhabib 2017-10-30
% horizontal function rxy=H_correlation(image1)
P=double(image1);
x1 = double(P(:,1:end-1));
y1 = double(P(:,2:end));
randIndex1 = randperm(numel(x1));
randIndex1 = randIndex1(1:1000);
x = x1(randIndex1);
y = y1(randIndex1);
Ex=(1/(1000))*sum(x);
Ey=(1/(1000))*sum(y);
Dx=(1/(1000))*sum((x(:)-Ex).^2);
Dy=(1/(1000))*sum((y(:)-Ey).^2);
coxy=(1/(1000))*(sum((x-Ex).*(y-Ey)));
rxy=coxy/(sqrt(Dx*Dy));
% vertical
function Vxy=V_correlation(image1)
P=double(image1);
x1 = double(P(1:end-1,:));
y1 = double(P(2:end,:));
randIndex1 = randperm(numel(x1));
randIndex1 = randIndex1(1:1000);
x = x1(randIndex1);
y = y1(randIndex1);
Ex=(1/(1000))*sum(x);
Ey=(1/(1000))*sum(y);
Dx=(1/(1000))*sum((x(:)-Ex).^2);
Dy=(1/(1000))*sum((y(:)-Ey).^2);
coxy=(1/(1000))*(sum((x-Ex).*(y-Ey)));
Vxy=coxy/(sqrt(Dx*Dy));
  3 个评论

请先登录,再进行评论。


Mahdiyar
Mahdiyar 2015-4-10
Hi singhal
May you explain more about horizontal and vertical correlation?
Regards,

praveen singhal
praveen singhal 2015-4-10
Hello sir, This paper use horizontal,vertical and diagonal correlation of an image.

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by