comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: creating elliptically shaped images
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: creating elliptically shaped images [message #37090 is a reply to message #37088] Mon, 24 November 2003 09:32 Go to previous messageGo to previous message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <a9116224.0311240712.618f4088@posting.google.com>,
mruschin@hotmail.com (mark) wrote:

> I'd like to form an image which has an elliptical shape and where all
> the pixels within this ellipse have values corresponding to any given
> function that I would specify, the simplest example being a uniform
> image (i.e. a value of 1 for all the pixels in the ellipse). Is there
> any nice way to do this in IDL or MATLAB other than looping through
> all the pixels and determining whether any given one lies within the
> ellipse?
>
> Mark

I think this does the trick.

Ken Bowman


nx = 300
ny = 300

a = 0.75
b = 0.50

x = 2.0*((FINDGEN(nx)+0.5)/nx - 0.5)
y = 2.0*((FINDGEN(nx)+0.5)/nx - 0.5)

xx = REBIN(x, nx, ny, /SAMPLE)
yy = REBIN(REFORM(y, 1, ny), nx, ny, /SAMPLE)

ellipse = 255*(xx^2/a + yy^2/b LT 1.0)

WINDOW, XSIZE = 300, YSIZE = 300
TV, ellipse
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Average outline of several contours
Next Topic: Code-correction please

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 14:23:03 PDT 2025

Total time taken to generate the page: 0.32424 seconds