Re: Is there function about how to compute joint probability distribution? [message #27953 is a reply to message #27876] |
Tue, 13 November 2001 01:44   |
bente
Messages: 13 Registered: October 2001
|
Junior Member |
|
|
Xiuying Wang <xiuying@cs.usyd.edu.au> wrote in message news:<3BEF063B.46048EA1@cs.usyd.edu.au>...
> Hi,
> I am doing research work now and I need to use joint probability
> distribution and marginal probability distribution. I wonder whether you
> can tell me how to do that in the shortest time, please?
> Many thanks!
>
> Best wishes,
> Xiu Ying
Hi,
I�m using Mutual Information on 3D-Arrays, so there I need the
JointProbability between the Intensities of both arrays.
I�ve done this with the Hist_2D Function.
Hist_2D gives the two dimensional density function ob both arrays. In
words, it gives the number of corresponding Pixels which have certain
intensities in eihter array (e.g. low intensity in A and high
intensity in B,...)
To get the joint probability I simply divided by the Total of the
histogram.
Here the part of my program for the mutual information
; mi, mutual information
if imeasure eq 4 then begin
hist = hist_2d( a, b )
hist = rotate(hist,7)
hist = float(hist)
pxy = hist / total(hist)
px = fltarr(256)
py = fltarr(256)
for j = 0, 255 do begin
px(j) = total(pxy(j,*))
py(j) = total(pxy(*,j))
endfor
col = replicate(1.0,256)
px_mat = px # col
py_mat = py # col
py_mat = rotate(py_mat,1)
pxxyy = px_mat * py_mat
pxyn = pxy * 0.0
index = where( pxxyy gt 0.0 and pxy gt 0.0, icount2)
;if (icount2 gt 0) then $
pxyn[index] = pxy[index] * alog( pxy[index] / pxxyy[index]) /
alog(2.0)
mi = total(pxyn)
endif
I don�t know exactly how your problem looks like, but maybe this can
help.
Kay
|
|
|