Does a sensor count the number of photons that hits it?

I'm interested in the grayscale image case. In a sensor there is an array of cavities which collect photons. (Source: Cambridge in Colour Digital Camera Sensors)

Does each cavity count the number of signals (or peaks) generated by each photon? Or is there one signal which is the sum of all photons (in which case the size of the signal should depend on photon energy presumably)?

And also I'm guessing each cavity correspond to a pixel?

Your link discusses how a CCD (charge coupled device) image sensor works. Note, CCDs have applications besides images sensors, but the vast majority of CCDs are used as image sensors, and that is the only primary application I will be discussing.

CCDs

In typical CCDs used for color image sensing each CCD cell has a color filter over it. The most commonly used pattern groups 4 cells together with one red filter, one blue filter, and two green filters. These filters only allow photons of their corresponding colors, in a certain frequency band through. A greyscale CCD just doesn't have these filters.

A CCD (when used as an image sensor) at its core is a photon counting device. A photon that is incident upon the active region of a CCD excites an electron through the photoelectric effect which is then stored within that cell of the CCD. This process continues as long as photons hit the cell causing electrons to accumulate within each cell.

Your camera lens projects an image of the scene you are taking a picture of onto the CCD. This is the same as in a film camera, except with film instead of a CCD. Each pixel corresponds to one cell within the CCD. In the case of a color image, each pixel is the the product of one or more filtered cells, depending on the algorithm and cell location. The simplest algorithm groups each set of 4 filtered cells into a single pixel. However it is common for interpolation schemes to increase the number of full color pixels to equal the number of CCD cells.

Photon Energy Dependence

The signal does depend on photon energy, but only as a threshold. In order for a photon to generate an electron through the photoelectric effect it must have a certain amount of energy. This amount of energy is the "bandgap" energy of the semiconductor. The bandgap energy of silicon is about 1.1 eV, meaning photons with a wavelength of about 1100 nm and lower will be detected. As you continue to increase photon energy the signal remains constant at one electron per photon. Once your photons have twice the bandgap energy, or more, an incident photon can generate two electrons, but it is fairly rare.

Once you have decided you are done taking your image the shutter is closed and it is time to read out what image was captured in the CCD. To read out the image the charge within each cell is shifted over one column within its row. The first column is then read out. This can be done by either measuring the current to discharge the cell, or measure the voltage of the cell while knowing the capacitance. Both of which can tell you how many electrons were stored in that cell. After the first column is read out, the cells are all shifted again, and this repeats until all cells have been read.

Non-Idealities

There are a number of factors that prevent typical CCDs from giving you an exact photon count. There is a significant amount of thermal noise that can only be reduced by lowering the temperature well below what is reasonable for a handheld camera to be capable of. There can be leakage within the CCD cells which can cause electrons to escape the cell, or move into nearby cells, which prevents an accurate count. There will also be photons that reflect off the cell, and therefore aren't counted.

However, none of this changes the fact that a CCD counts photons. It just means it isn't a very precise photon counter. More on this below.

Does a CCD Count Photons?

I believe it does, but it comes down to the definition of "count". Lets consider an analogy.

Alice, Bob, and Chris each own an apple orchard. They want to know how many apples have fallen off the trees in their orchards. To do this they use a Tennis Ball Coupled Device (TBCD). It might look like an ordinary basket, but trust me, its a TBCD. Alice, Bob, and Chris walk through their orchards putting a tennis ball in the TBCD for each apple they see on the ground. By the time they have finished, each has a number of tennis balls in the TBCD equal to the number of apples that fell off the trees.

To figure out how many apples fell off the trees, Alice, Bob, and Chris each use a different method. Alice proceeds to count out the number of tennis balls in her TBCD. When she is done, she knows exactly the number of apples she saw. Bob is not as patient as Alice and uses an advanced computer vision system to automatically count the apples in his TBCD. When he is done, he knows approximately the number of apples he saw, but there is a small error because the CV system isn't perfect. Chris can't afford such a system, nor is he as patient as Alice, so he weighs his TBCD and using the weight of a tennis ball can determine approximately how many tennis balls there are.

Now here is the question. Who of these people used a system that counted the number of apples that fell in their orchards? Each at one point had a number of tennis balls equal to the number of apples. Does the readout method impact whether or not the TBCD counts apples that fell onto the ground?

The TBCD is (unsurprisingly) directly comparable to a cell in a CCD. It stores a number of electrons equal to the number of photons it captured. This most certainly qualifies as a photon count. Then, depending on your readout circuit, you might get a more or less precise reading of this value. Is it a count? If my image sensor counts the number of photons, but doesn't tell anyone, did it still count the number of photons? As I said earlier, I think this comes down to your definition of count, but I believe a CCD qualifies as a photon counting device.

• @MikeBrockington a CCD counts photons in the same was as a kitchen scale counts baryons, because it measures a value approximately proportional to the number of protons and neutrons in the stuff you place on in. This isn't the usual of definition of 'count'. – Pete Kirkham Jul 5 '19 at 15:22
• @Pete You should post that as an anwer - I read the one above, and as you can tell, couldn't decide whether Matt was saying yes or no. – Mike Brockington Jul 5 '19 at 15:24
• Detectors running on the same basic physics as CCDs can be (routinely are in particle physics contexts) instrumented in such a way that they can say "hey, three photons hit this element" and mean neither two nor four (five is right out). But when the number of hits grows larger the resolution begins to encompass nearby integers. That is, if you get a result of 103 from the same element it might mean anywhere from 100 to 106. So high-confidence integer-valued counts are not a yes/no phenomena, but depend on the backing electronics and the magnitude of the signal. – dmckee --- ex-moderator kitten Jul 5 '19 at 17:06
• One major quibble with this answer: what you call sub pixels are actually full pixels. Say you have a sensor advertised as having 20 megapixels. This sensor will have 20 million individual pixel sites. 5 million will have red filters, 5 million will be blue and 10 million will be green, arranged in what’s known as a Bayer pattern. When the raw image is converted to JPEG (or other image format) the color of each pixel will be interpolated using the data at that image site and its neighbors. – Jim Garrison Jul 6 '19 at 6:10
• If you have a 100x100 grayscale ccd you have 10,000 grayscale pixels total. If that grayscale CCD is overlaid with a Bayer filter you now have a 10,000 pixel mosaic consisting of 5,000 green pixels and 2500 each red and blue. After demosaicing you have a 10,000 pixel color image. – Jim Garrison Jul 6 '19 at 18:58

No, you won't obtain the photon count directly. Also, a camera sensor has noise, not just from photon counting but also from electrical circuits.

Also, a DSLR has a color filter on top of the pixels, even if you take only grayscale images. It will probabilistically filter away some photons. If the photon is of the correct color, chances of it passing the filter are much higher than with an incorrect colored photon.

There are sensors that count incoming photons, but a DSLR sensor is not among them. DSLR sensor just gives a single "intensity" value per pixel that is full of noise. It is roughly similar to sum of all incoming photons, but because of the noise, you can't tell the number of photons exactly as an integer.

If you are looking for a photon counting detector, this may not be the best place to ask. There is no Scientific Instrument Stack Exchange, but Physics Stack Exchange may come close.

Typically, photon counting detectors are cooled with liquid nitrogen to really low temperatures to minimize electrical noise coming from thermal effects. Needless to say, a DSLR isn't designed to be cooled to such low temperatures.

At shorter wavelengths such as X rays, you can actually count photons using a room temperature sensor, so no cooling required. However, light has far longer wavelength than X rays. I'd say it would make a great question on Physics Stack Exchange to ask whether a visible light photon counting sensor can be made without requiring cooling.

• I haven’t seen liquid nitrogen cooled dslr, but there are a few companies making coolers targeted toward astrophotographers on the market. – OnBreak. Jul 4 '19 at 18:16
• You can count visible-light photons if the rate of arrival is low enough for sure. Eyes can do this (I think dark-adapted human eyes are sensitive on the order of 10 photons but ?cats? and ?frogs? can detect single photons. – user82065 Jul 4 '19 at 21:15
• "whether a visible light photon counting sensor can be made without requiring cooling" - I'm sure if we could, we would. – whatsisname Jul 4 '19 at 22:28
• Relevant to @tfb's comment: biology.stackexchange.com/questions/85026/… – Carsten S Jul 5 '19 at 9:21

The sensor is an array of silicon photodiodes that simply convert light energy into electricity. They are interchangeably called pixels, photo sites, photo diodes. Pixel actually refers to picture element and it is the least accurate term in this aspect. Because each pixel uses information from adjoining photosites to determine its' color/brightness value, even for greyscale output (other than possibly a monochrome camera like the Leica Monochrom). But the location of a photo site does directly correlate with the location of a pixel in the output image.

Does each cavity count the number of signals (or peaks) generated by each photon?

No. There are no individual peaks to count.

Or is there one signal which is the sum of all photons (in which case the size of the signal should depend on photon energy presumably)?

Yes, more or less, an electrical current is generated that corresponds to the summation of the energy of the photons that hit the sensel during the time period of interest.

And also I'm guessing each cavity correspond to a pixel? ... in the grayscale image case.

Yes, for grayscale. For color, additional color information is interpolated from surrounding sensels (demosaicing). But for most purposes, it's fine to think of it as having a 1-1 correspondence.

No.

A sensor measures the cumulative amount of energy released when photons strike it.

Since photons oscillating at different wavelengths/frequencies release slightly different amounts of energy when they strike a sensor, knowing the cumulative amount of energy collected by each photosite (a/k/a sensel, pixel well, etc.) can not be used to determine the exact number of photons that fell on it.

The range of wavelengths allowed through each color filter on Bayer masked sensors is far too wide to be able to determine what discrete wavelengths of light created the energy each photosite has collected.

Yes. A pixel roughly counts the number of photons which fall onto it. However, that number of photons is subsequently processed before the digital grayscale number (0-255, for example) is reported. This digital number is reported in what may be referred to as analog digital units, ADUs. One must do some reverse math to convert the ADU number back into number of photons.

The following math should illuminate the situation for you. Assume a pixel area of A, an exposure time of T. Suppose we are illuminating with monochromatic light with frequency W. Physics tells us that the intensity of light can be calculated as

I = hbar * W * N

hbar is Planck's constant and N is the number of photons passing through a unit per unit time. N is the photon flux.

We can see that if the exposure time is T then the number of photons passing through a particular pixel will be given by

N_pixcount = N * A * T = I * A * T/(hbar * W)

So given pixel area, light intensity, exposure time, and light frequency it is possible to calculate the average number of photons which pass through a pixel.

How does a sensor register photons? For an ideal sensor, every time a photon falls on the sensor a photoelectron e- would be created. However, because sensors have finite quantum efficiency QE, only a sub-unity fraction of photons are converted into photoelectrons.

N_electron = QE * N_pixcount

Practical sensors may have quantum efficiencies anywhere from 30% up to 95% or so.

After the photoelectrons are created the electron count is 1) converted into a voltage (using a charge amplifier) and then this voltage is converted into a digital signal (usings an analog-to-digital converter, ADC). These two stages are described by a signal specification for a sensor called the gain, G. The gain is specified in e-/ADU. That is, how many electrons are necessary to increase the grayscale level by 1. Putting this together we can see:

grayscale_level = N_electron/G = N_pixcount * QE/G = I * (QE * A * T)/(hbar * W * G)

This is a rough overview of how photons are converted into digital counts for a digital sensor. There are few more things that I haven't covered here. Namely 1) there is noise introduced in each of these stages that should be considered if you care about image quality and 2) some sensors will have additional post-processing amplification stages. For example, different pixels may be put through gain stages with different gains to help homogenize the sensor response.

Regarding your question about the dependence on photon energy. We can see that the photon wavelength comes in in the conversion between intensity and photon number flux. The core part of my answer is that sensors are photon counting devices, it doesn't matter the energy of the photons. However, it is important to bear in mind that the for all real sensors the quantum efficiency is wavelength dependent. This means that a blue photon may have a better chance of being detected than a red photon. Thus, to determine what a sensor will read you need to figure out the photon flux for each wavelength included in the illumination and multiply through by the relevant factors to figure out the overall contribution to the pixel count due to all illumination wavelengths present.

• With Bayer masked sensors, regardless of the specific color of the filter over each photosite, some photons from the entire visible spectrum will make it through each of the colored filters used in the Bayer mask. You can only use an imaging sensor as a photon counter if the filter over the photosite is narrow enough to only let very specific wavelengths through and totally reject all other wavelengths. Spectrometers are filtered in this way, but imaging sensors used by cameras are not. – Michael C Dec 23 '19 at 3:04