1

I have a question as follows:

Suppose I have an image(size=360x640(row by col)), and I have a center coordinate that's say is (20, 100). What I want is to generate a probability distribution that has the highest value in that center (20,100), and lower probability value in the neighbor and much more lower value farer than the center.

All I figure out is to put a multivariate gaussian (since the dimension is 2D) and set mean to the center(20,100). But is that correct and how do I design the covariance matrix?

Thanks!!

HenryChen
  • 153
  • 3
  • 12
  • The title of the question asks one thing, but the question itself has a completely different question. “is that correct and how do I design the covariance matrix?”. That depends 100% on the application. Why do you need the probability? What does it mean? How will you use it? Can’t answer your question without knowing these things. – Cris Luengo Jan 28 '19 at 19:29
  • This article about radial transform may help: https://arxiv.org/pdf/1708.04347.pdf – salehinejad Sep 24 '19 at 13:34

1 Answers1

0

You could do it in 2D by generating radial and polar coordinates

Along the line:

Pi = 3.1415926
cx = 20
cy = 100

r = sqrt( -2*log(1-U(0,1)) )
a = 2*Pi*U(0,1)

x = scale*r*cos(a)
y = scale*r*sin(a)

return (x + cx, y + cy)

where scale is a parameter to make it from unitless gaussian to some unit applicable to your problem. U(0,1) is uniform in [0...1) random value.

Reference: Box-Muller sampling.

If you want generic 2D gaussian, meaning ellipse in 2D, then you'll have to use different scales for X and Y, and rotate (x,y) vector by predefined angle using well-known rotation matrix

Severin Pappadeux
  • 18,636
  • 3
  • 38
  • 64