如何使用matlab计算图像中像素的垂直和水平相关性? [英] How do I calculate the vertical and horizontal correlation of pixels in an image using matlab?

查看:1125
本文介绍了如何使用matlab计算图像中像素的垂直和水平相关性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算加密图像的像素相关性(对于垂直和水平像素对)。我知道corr并将其用作

RHO = corr(X)



但它将相关性作为相关矩阵给出(i想想每个像素,它显示出不同的相关性)但我想要整个图像的一个相关性来比较一些加密图像,通过不同的算法加密。



< b>我尝试了什么:



i尝试过 -

RHO = corr(图片)



corr2(图片);

但它不起作用。

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.

推荐答案

我的朋友Ali B.说...这样:



函数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('位置上的像素灰度值(x,y)')

ylabel('位置上的像素灰度值(x + 1,y)')

结束





复制和粘贴自:
MATLAB Central [ ^ ]

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[^]
)


这篇关于如何使用matlab计算图像中像素的垂直和水平相关性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆