Say I have an arbitary image of stars and galaxies without any extra information (no other spectra info other than image itself). Can you help me distinguish them?

Are there any specific features / properties I could look for? Say for eg the R G or B value or maybe values in some other color space (YUV etc.) be more or less for stars than galaxies, etc.


I dont have any "special" data (no sensor or spectral data), I only have data from the internet (common images). The point is to detect stars and galaxies from images commonly found on the internet.

One of them is this: https://cdn.spacetelescope.org/archives/images/large/heic0916a.jpg

  • $\begingroup$ Too broad. Say exactly what data you have and what kind of galaxies you are interested in. Galaxies do in general have spectral energy distributions that are different to stars, but there is considerable overlap and it depends on what kind of galaxy. Stars are not spatially extended, which is perhaps the main way of separating stars and galaxies on an image. $\endgroup$
    – ProfRob
    Apr 19, 2017 at 7:34
  • $\begingroup$ Say I just want to do stars-galaxy separation, the galaxy can be of any type. Check my update for a sample image, can you elaborate " Stars are not spatially extended, which is perhaps the main way of separating stars and galaxies on an image" $\endgroup$
    – astroman
    Apr 19, 2017 at 12:37
  • 1
    $\begingroup$ Stars are point sources. Galaxies may not be. The image of a star will be a scalar multiple of the point spread function of the instrument. A galaxy image will be broader than this. You are asking for a simple answer to what is most decidedly not a simple question. You also cannot realistically work from compressed jpeg images picked up from the internet. $\endgroup$
    – ProfRob
    Apr 19, 2017 at 12:39
  • $\begingroup$ Dumb question but can I estimate the PSF of a camera from an image?? $\endgroup$
    – astroman
    Apr 19, 2017 at 12:55
  • $\begingroup$ Also someone suggested I could use the NED Database for getting a count of the galaxies in the image, but I cannot seem to use it at all $\endgroup$
    – astroman
    Apr 19, 2017 at 13:00

1 Answer 1


If you have the CCD data and instrument profile, then a star may be treated as a "point source" and a galaxy as an "extended source". This means that, under ideal conditions a star will have it's light spread through the "point spread function" of the telescope, usually these objects have a Gaussian(ish) intensity profile with one pixel of the CCD claiming most of the light and adjacent pixels falling off in intensity, while a galaxy will have an extended, flattened profile with 2 or 3 or 20 pixels claiming most of the light and then falling off in adjacent pixels.

If you have the full CCD information, this is the method of choice. This breaks down when galaxies are so far away that they are resolved smaller than the "point source" stars (larger telescopes can resolve farther away galaxies as extended than smaller, back yard telescopes).

If you just have catalog data, such as colors, then you want to look for items falling off of the "stellar color locus." Stars, in color space tend to sit on a "ribbon" in color-color space (see this from Yanny+2000)

enter image description here

Objects with colors which do not lie on this "ribbon" are special objects. For example the box labeled "Q" is Quasars, which is a type of galaxy. Not shown in this image is a "cloud" of objects which are galaxies (in this image, the cloud will start around that quasar box and extend much redder in both color axes). If you take all of your objects from a telescope and plot them in any(ish) color-color space you will find a tight band, which are stars, and a cloud near this band (which are galaxies). This is because stars operate as a blackbody, while galaxies operate as a dual blackbody (with a lot of light emitted by the stars, following the same blackbody radiation profile, and a lot of gas absorbing this light and re-emitting it in cooler, infrared blackbody colors).

This method is not perfect, this is a statistical method for selecting say 90% galaxies.

Note: Rob is absolutely correct that you cannot do any of these with jpeg images. A lot of jpegs, especially promotional images have had their colors doctored, or even include false colors (for example to represent ultraviolet or infrared light; this is also why you can't do this with random jpegs, each camera will have it's own way of representing color, so my polaroid camera picture will give different colors than a modern random DLSR camera... you can only do this if all the images are collected from identical cameras). jpegs also do not include the "full CCD information" ie. the intensity of light falling onto each pixel of the CCD.

Note 2: Yes you can estimate the PSF for a telescope with an image, but only a CCD image which shows the photon count in each pixel. A CCD image is a 3d image, which shows how many photons fall into each bin, a jpeg does not have this information, so it is... impossible I think, unless the jpeg is produced to show the photon count and not the color.

  • $\begingroup$ "(larger telescopes can resolve farther away galaxies as extended than smaller, back yard telescopes)." Not really. Any telescope larger than about $30\,\mathrm{cm}$ is going to be seeing limited without fancy techniques like adaptive optics. $\endgroup$
    – Sean Lake
    Apr 19, 2017 at 15:53
  • $\begingroup$ Can I ask you something? What is a good colorspace for comparing stars and galaxies in your opinion? What is a good colorspace for processing astronomical images in general? $\endgroup$
    – astroman
    Apr 19, 2017 at 22:02
  • $\begingroup$ @Sean: I'm not talking about the diffraction limited resolution of the optics. I'm talking about the psf resolution of the instrument. Yes, physics wise it is possible to get large resolution with small lenses. The downside is, to get enough light town the tubes to accommodate a CCD dense enough to get this large resolution image is going to take way longer on a camera lens than on an 8m class telescope (think hundreds of times longer) ... which is one of the reasons why we bother building telescopes larger than 30 cm. Sorry for the confusion. $\endgroup$
    – ohrkzt
    Apr 20, 2017 at 6:55
  • $\begingroup$ @astro I think it's good to use a short wavelength and a long wavelength. A short wavelength to collect the ultraviolet radiation, and a long wavelength to collect the infrared re-radiation. It's hard for stars to have the same colors in bands like that. I know 2MASS J and WISE W1 have been shown to separate stars and galaxies pretty precisely. In general, all colors have benefits. Ultraviolet for young stars, infrared for looking in the inner galaxy and plane, optical for astrometry and proper motion precision (asteroids), radio to study dust... Every color has it's own strong/weak points $\endgroup$
    – ohrkzt
    Apr 20, 2017 at 8:36
  • $\begingroup$ @ohrkzt Be careful with that J/W1 separation - it's not just a color. The 2MASS psf is around 1 arcsec FWHM, WISE's is 6 arcsec in W1. So just taking that ratio implicitly has both color and concentration/morphological information in it. To get a real color you should either use matched apertures or psf matched images. Punchline: it'll call nearby compact galaxies stars. $\endgroup$
    – Sean Lake
    Apr 20, 2017 at 15:54

Not the answer you're looking for? Browse other questions tagged .