<p>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.</p>

<p>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).</p>

<p>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 <a href="http://adsabs.harvard.edu/abs/2000ApJ...540..825Y" rel="nofollow noreferrer">Yanny+2000</a>)</p>

<p><a href="https://i.sstatic.net/tCQ71.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tCQ71.png" alt="enter image description here"></a></p>

<p>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).</p>

<p>This method is <em>not</em> perfect, this is a statistical method for selecting say 90% galaxies.</p>

<p>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.</p>

<p>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.</p>

CC BY-SA 3.0
2017-04-19T15:53:51.733Z
"(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.
Sean Lake
CC BY-SA 3.0
2017-04-19T22:02:45.107Z
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?
astroman
CC BY-SA 3.0
2017-04-20T06:55:35.527Z
@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.
ohrkzt
CC BY-SA 3.0
2017-04-20T08:36:39.353Z
@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
ohrkzt
CC BY-SA 3.0
2017-04-20T15:54:56.773Z
@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.
Sean Lake
CC BY-SA 3.0
2017-04-21T12:43:08.467Z
@Sean this is irrelevant to the questioners question and obviously beyond the scope. But I'll bite. It's actually possible to draw statistics from such a sample owing to the fact that the psf is an error on the measurement, usually gaussian. So, if you crossmatch correctly, using the PSF radii added in quadrature, you will get a statistically robust sample. There will, as you correctly state, be a small systematic bias for compact galaxies. However, that bias is negligible to the utility of the tool. Tens vs tens of thousands, it's the reality of actual data.
ohrkzt
CC BY-SA 3.0
2017-04-19T15:18:31.707Z
2017-04-19T15:48:55.383Z
2017-04-19T15:48:55.383Z
ohrkzt
<p>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? </p>

<p>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.</p>

<p>EDIT:</p>

<p>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.</p>

<p>One of them is this: <a href="https://cdn.spacetelescope.org/archives/images/large/heic0916a.jpg" rel="nofollow noreferrer">https://cdn.spacetelescope.org/archives/images/large/heic0916a.jpg</a></p>

CC BY-SA 3.0
2017-04-19T07:34:48.223Z
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.
ProfRob
CC BY-SA 3.0
2017-04-19T12:37:16.247Z
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"
astroman
CC BY-SA 3.0
2017-04-19T12:39:29.793Z
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.
ProfRob
CC BY-SA 3.0
2017-04-19T12:55:29.660Z
Dumb question but can I estimate the PSF of a camera from an image??
astroman
CC BY-SA 3.0
2017-04-19T13:00:55.480Z
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
astroman
CC BY-SA 3.0
2017-04-19T13:00:58.580Z
https://ned.ipac.caltech.edu/cgi-bin/OBJatt?delimiter=bar&nondb=row_count&crosid=objname&position=ra%2Cdec&enotes=objnote&position=pretype&position=z&position=zflag&attdat_CON=M&attdat_CON=S&attdat=attned&gphotoms=q_value&gphotoms=q_unc&gphotoms=ned_value&gphotoms=ned_unc&diamdat=ned_maj_dia&distance=avg&distance=stddev_samp&M=2524&M=2472&M=2872&M=2871&M=2992&M=2529&M=3000&M=3004&M=1019&M=1024&M=1029&M=1036&M=1040&M=1048&M=1052&M=1058&M=1061&M=1069&M=1072&M=1079&M=1081&M=2390&M=2425&M=994&M=996&M=998&M=598&M=1&M=1004
astroman
<star><galaxy><data-analysis><photography>
Image processing techniques to distinguish between stars and galaxies in an image?
astroman
# Image processing techniques to distinguish between stars and galaxies in an image?

(Asked by: username_0 on 2017-04-19)

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.

EDIT:

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>

**Tags:** star, galaxy, data-analysis, photography
> **Comments:**
> **username_1**: 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.  
> **username_0**: 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"  
> **username_1**: 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.  
> **username_0**: Dumb question but can I estimate the PSF of a camera from an image??  
> **username_0**: 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  
> **username_0**: https://ned.ipac.caltech.edu/cgi-bin/OBJatt?delimiter=bar&nondb=row_count&crosid=objname&position=ra%2Cdec&enotes=objnote&position=pretype&position=z&position=zflag&attdat_CON=M&attdat_CON=S&attdat=attned&gphotoms=q_value&gphotoms=q_unc&gphotoms=ned_value&gphotoms=ned_unc&diamdat=ned_maj_dia&distance=avg&distance=stddev_samp&M=2524&M=2472&M=2872&M=2871&M=2992&M=2529&M=3000&M=3004&M=1019&M=1024&M=1029&M=1036&M=1040&M=1048&M=1052&M=1058&M=1061&M=1069&M=1072&M=1079&M=1081&M=2390&M=2425&M=994&M=996&M=998&M=598&M=1&M=1004  

---

## 1 answers

### Answer by username_2 on 2017-04-19. Score: 3 | Accepted answer

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](http://adsabs.harvard.edu/abs/2000ApJ...540..825Y))

[![enter image description here](https://i.sstatic.net/tCQ71.png)](https://i.sstatic.net/tCQ71.png)

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.

> **Comments:**
> **username_3**: "(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.  
> **username_0**: 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?  
> **username_2**: @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.  
> **username_2**: @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  
> **username_3**: @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.  
> **username_2**: @Sean this is irrelevant to the questioners question and obviously beyond the scope. But I'll bite. It's actually possible to draw statistics from such a sample owing to the fact that the psf is an error on the measurement, usually gaussian. So, if you crossmatch correctly, using the PSF radii added in quadrature, you will get a statistically robust sample. There will, as you correctly state, be a small systematic bias for compact galaxies. However, that bias is negligible to the utility of the tool. Tens vs tens of thousands, it's the reality of actual data.  

---

