Photometry is a technique that measures the brightness of a star in an image. Each pixel on a CCD will have had a certain number of photons fall on it during an exposure. This number of photons translates to a number of electrons that are stored in the CCD until it is read out. The more photons hit a certain pixel, the more electrons will be stored there.
On an actual CCD, the grids pictured above are not visible, as seen below in an example CCD from one of LCOGT's Faulkes Telescopes.
Photometry with an Image
In a CCD image, each star will appear as a smeared out circle covering several pixels. A line can be drawn through the star and its profile brightness can be seen as a curve. An increase in brightness on the image and on the graph represents an area on the CCD that had more photons land on it. When the CCD was read out, there were more electrons stored in those pixels, representing a bright object.
When doing photometry, a circle (usually called an aperture) is placed around each star whose brightness is to be measured. Software is then used to add up the number of electrons (now often called counts) in each pixel within that circle. Many photometry programs automatically create an aperture for each star with a radius that is the full width half maximum of the brightness curve for the star.
When measuring the brightness of an object or objects over several images taken over time, comparison stars must be used. By using a comparison star or stars, variation in brightness that can be caused by sources such as the atmosphere is removed. For example, if over the course of several exposures, a thin cloud passed over the telescope, the brightness of all of the stars in the image would be decreased by a similar amount. By using comparison stars, effects like these are divided out. Comparison stars that are of similar brightness to the target star, not very close to other stars, and not near the edge of the frame make the best choices. Astronomers usually compare the comparison stars, and don't use ones that are variable stars.
Over a whole image, there is always a certain amount of background brightness or noise from the sky. Some of this effect can be removed automatically by software. Removing the average level of this noise is called sky-subtraction.
One common sky-subtraction technique is to create an annulus outside the aperture of the star being measured. Then the number of counts in this area is divided by the area of the annulus. This gives a value for the average amount of extra photons coming from the sky per pixel. This value can then be multiplied by the area of the aperture and then subtracted from the value found for the star's brightness.
An alternative technique is to place a circle with the same radius as the aperture in an area of the image, near the target, that appears to have no stars. The total brightness of this circle can be divided by its area to get the average number of counts per pixel that are coming from sky background noise.