When creating a Deep Space Nebula for Celestia, one of the problems is that there usually are many foreground and background stars in the astronomical picture. Those stars probably shouldn't be included in a model of the nebula.
This method of removing stars works best for red nebulosities associated with bright, blue stars. It replaces the stars by a blurred image of the surrounding nebula.
This example nebula, N70, is an intermediate result taken from a larger project which is not yet completed.
For my personal convenience, this method uses both NetPBM and ImageMagick utilities. I'm sure an equivalent method could be devised using just ImageMagick or some other utilities.
Start with a high resolution, colored image. For convenience, this script scales the original, high resolution image down to 512x512. jpegtopnm phot-40d-99-hires.jpg >tmp1.ppm pnmcut -height 1993 tmp1.ppm >tmp2.ppm pnmpad -black -right 25 -left 26 -top 27 -bottom 28 tmp2.ppm >tmp1.ppm pnmscale -width 512 tmp1.ppm >tmp2.ppm convert tmp2.ppm n70.jpg This image of N70, a nebula associated with the Large Magellenic Cloud, was derived from a photograph taken by the ESO's Very Large Telescope. For more information, see the ESO press release at http://www.eso.org/outreach/press-rel/pr-1999/pr-17-99.html
|
![]() |
Filter out the bright spots, producing a blurred, colored image. The value for noise has to be determined by trial and error, depending on how well the stars have been removed from the resulting blurred image. convert -noise 9 tmp2.ppm tmp3.ppm convert tmp3.ppm n70-blurred.jpg |
![]() |
From the original, sharp, colored image, extract the blue channel. Assume that it contains only stars, since this is a red nebula. Create a mask by "normalizing" the image: force dark regions to be black and brighter regions to be white. The values chosen for bvalue and wvalue have to be determined by trial and error. You have to judge how well the stars have been removed from the final image. ppmtorgb3 tmp2.ppm cp tmp2.blu tmp2.pgm pnmnorm -bvalue 63 -wvalue 66 tmp2.pgm >tmp3.pgm convert tmp3.pgm n70-bluemask.jpg |
![]() |
Using the blue channel image as a mask,
replace those masked locations
in the original (sharp) image
by those same locations from the blurred, colored image.
pnmcomp -alpha tmp3.pgm tmp3.ppm tmp2.ppm >tmp4.ppm convert tmp4.ppm n70-nostars.jpg |
![]() |
Here's a DSC file to place this Nebula image appropriately.
I'll leave it to you to provide a "billboard" mesh for the Nebula.
|
If you don't tell me that something's missing, unclear or wrong, I can't improve it.