Number of pixels [message #33377] |
Wed, 25 December 2002 19:17 |
idlfreak
Messages: 47 Registered: October 2001
|
Member |
|
|
Hi...
I'm trying to create a binary 2D and 3D object. I tried to create a
sphere with array size of (20x20x20). The sphere obtained was not
binary but had different grey levels. Also, when i calculated the
total number of pixels in the sphere it was more than 8000 (20x20x20).
Why does the pixel count differ? Then what is the use of declaring an
array size of 20x20x20. how can i draw a sphere based on the pixel
count? i.e. a sphere of radius 50 means 50 pixels.
Please help me.
Regards,
Akhila.
P.S: The code i used to create a sphere is given below.
PRO sphere
sphere = FltArr(20, 20, 20)
FOR x=0,19 DO FOR y=0,19 DO FOR z=0,19 DO $
sphere(x, y, z) = SQRT((x-10)^2 + (y-10)^2 + (z-10)^2)
Shade_Volume, sphere, 8, vertices, polygons
Scale3, XRange=[0,20], YRange=[0,20], ZRange=[0,20]
image = PolyShade(vertices, polygons, /T3D)
TV, image
sphere = bytscl(sphere)
Image_Statistics, sphere, MASK = sphere, COUNT = cntsphere
print, 'cntsphere', cntsphere
END
|
|
|