图像的联合概率分布

如何计算两幅图像的联合概率分布

https://www.medphysics.wisc.educourses/mp573/2010/mutualinformation_revised.pdf

中给出的定义是:

The spatial information obviously required for a registration method is provided by the definition of a joint probability distribution that depends simultaneously on image A and B. The conventional expression for it is p A , B ( a , b ) p_{A,B} (a, b) pA,B(a,b). It is calculated as the number of times out of the total number of pixels N that a pixel in A contains the value a and the same pixel that is, the pixel in the same image position, in B contains the value b; this number of pixels is then divided by the total number of pixels to give the joint probability of a,b.

个人的理解是:

  • 图像配准需要的空间信息取决于图像A和B的联合概率分布,它的常规表达式是 p A , B ( a , b ) p_{A,B} (a, b) pA,B(a,b)
  • 统计图像A中像素为a的位置,计算B中处于和a相同位置的像素b的个数n;
  • 将n除以像素总数N,得到a,b的联合概率。

假如图像分别为
A = ( 1 1 2 2 7 1 ) A=\left(\begin{array}{lll}1 & 1 & 2 \\2 & 7 & 1\end{array}\right) A=(121721)
B = ( 1 2 2 2 1 2 ) B=\left(\begin{array}{lll}1 & 2 & 2 \\2 & 1 & 2\end{array}\right) B=(122122)
则图像的联合概率分布为
p A , B ( 1 , 1 ) = 1 6 p_{A,B}(1,1)=\frac 16 pA,B(1,1)=61
p A , B ( 1 , 2 ) = 2 6 p_{A,B}(1,2)=\frac 26 pA,B(1,2)=62
p A , B ( 1 , 7 ) = 0 6 p_{A,B}(1,7)=\frac 06 pA,B(1,7)=60
p A , B ( 2 , 1 ) = 0 6 p_{A,B}(2,1)=\frac 06 pA,B(2,1)=60
p A , B ( 2 , 2 ) = 2 6 p_{A,B}(2,2)=\frac 26 pA,B(2,2)=62
p A , B ( 2 , 7 ) = 0 6 p_{A,B}(2,7)=\frac 06 pA,B(2,7)=60
p A , B ( 7 , 1 ) = 1 6 p_{A,B}(7,1)=\frac 16 pA,B(7,1)=61
p A , B ( 7 , 2 ) = 0 6 p_{A,B}(7,2)=\frac 06 pA,B(7,2)=60
p A , B ( 7 , 7 ) = 0 6 p_{A,B}(7,7)=\frac 06 pA,B(7,7)=60

  • 虽然有 3 2 3^2 32个可能的有序像素值对需要考虑,但总匹配数将只有6个。至于我们是否应该称之为“两幅图像的联合概率分布”——这只是作者们想要使用的术语。有很多种方法来获取图像的属性并定义联合分布。

https://www.physicsforums.com/threads/joint-probability-distribution-of-two-images.589741/

参考两幅图像联合熵的概念,对上述理解用Matlab进行验证

%A=rgb2gray(imread('img1.png'))
%B=rgb2gray(imread('img2.png'))

% 给出A,B矩阵
img1=[1,1,2;2,7,1];
img2=[1,2,2;2,1,2];
A=double(img1)+1;
B=double(img2)+1;
[M,N]=size(A);
Large=max(max(max(A),max(B)))+1;
temp=zeros(Large,Large);
for m=1:M
	for n=1:N
		i=A(m,n)
		j=B(m,n);
		temp(i,j)=temp(i,j)+1;
	end
end
temp=temp./(M*N);

验证temp为
[ 1 / 6 2 / 6 ⋯ 0 0 2 / 6 ⋯ 0 ⋮ ⋮ ⋱ ⋮ 1 / 6 0 ⋯ 0 ] \begin{bmatrix} {1/6}&{2/6}&{\cdots}&{0}\\ {0}&{2/6}&{\cdots}&{0}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {1/6}&{0}&{\cdots}&{0}\\ \end{bmatrix} 1/601/62/62/60000
与上述计算一致。

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值