Re: saving ellipse to image [message #80904] |
Tue, 24 July 2012 13:40 |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Tuesday, July 24, 2012 3:37:28 PM UTC-4, Kat wrote:
> Hi guys,
> I'm trying to make an image in idl containing an ellipse
You can also use dist_ellipse.pro in the Astron library to create an array in which each element is equal to the semi-major axis of the ellipse of specified center, axial ratio, and position angle, which passes through that element.
This array can then be used to create an ellipse of any size.
;Make a 1000 x 1000 mask array with ellipse centered at [400,500], with an
;axial ratio of 1.5, and a position angle of 15 degrees from the Y axis.
IDL> dist_ellipse,im,1000,400,500,1.5,15
IDL> g = where(im lt 300,comp=gg) ;Get points with major axis lt 300 pixels
IDL> im[g] = 255 ;Pixels within ellipse
IDL> im[gg] = 0 ;Pixels outside ellipse
IDL> cgimage,im
|
|
|