blurry ellipse
- To: mathgroup at smc.vnet.net
- Subject: [mg92033] blurry ellipse
- From: "Solomon, Joshua" <J.A.Solomon at city.ac.uk>
- Date: Thu, 18 Sep 2008 06:11:07 -0400 (EDT)
- Organization: Posted via ULCC Internet Services
NB: This is a mathematical problem, not necessarily a Mathematica problem. I need a rasterized, blurry ellipse, i.e. an ellipse convolved with a Gaussian. I already know how to make a blurry circle. You take the Fourier transform of a circle (i.e. a Bessel function), the Fourier transform of a Guassian, multiply them, and transform them back. No problem. Since an ellipse is just a circle that has been squashed in one dimension, I figured I could make a blurry one the same way as I make blurry circles. I just needed to squash the Bessel function first. And I was right. The code below works just fine, *except* the intensity varies as you go around the elipse. If anyone could tell me how to fix that problem, I'd be very grateful! BlurryEllipse[sizePix_, radiusPix_, sigmaPix_,stretchFactors_: {1, 1}] := Module[{half = sizePix/2, x, y, f, r, a, pr2}, f = 2*Pi*radiusPix/sizePix; pr2 = -2 (Pi*sigmaPix/sizePix)^2; RotateRight[ Abs[ Chop[ InverseFourier[ RotateRight[ Table[r1= Abs[stretchFactors[[1]]*x+ stretchFactors[[2]]*I*y]; r2 = Abs[x + I*y]; BesselJ[0, f*r1] Exp[pr2 (r2^2)], {y, -half, half-1} , {x, -half, half-1}], {half, half}]]]], {half,half}]] size = 64; rad = 24; scale = 3; tmp = BlurryEllipse[size, rad, scale, {1, .5}]; Show[Graphics[Raster[tmp/Max[Max[tmp]]]], ImageSize -> 400] Intensity varies around the elipse. We can compare amplitude (or power) ratios between major and minor axes: In[]:=Max[tmp[[33]]]/Max[Transpose[tmp][[33]]] Out[]=1.93009 In[]:= Sqrt[Total[tmp[[33]]^2]/Total[Transpose[tmp][[33]]^2]] Out[]= 1.98887 I was surprised these numbers weren't closer to 2. How can we make intensity invariant around the ellipse?