<p>Really, all cameras/detectors are greyscale detectors.  Every pixel in a CCD detector puts out a single number for the number of photons it detected. To create an RGB image you need three filters.  If you have 3 detectors, you can put a different filter in front of each and get 3 numbers at once.  If you have 1 detector, then you take 3 measurements with a different filter each time.  To create the color image, one combines these values but you have freedom to weight them as you like.  Typically, one tries to imitate the sensitivity of the eye, but that is a complicated issue since the sensitivity of the eye to different colors changes with total intensity and the filters can not exactly reproduce the eye's bandpasses.  So, there is no right way to do this.  Some people like red more than blue, so they weight the R-band more. Once, you get aR+bG+cB, you loose the information you need to derive R, G, and B separately.  </p>

<p>So, to do your experiment properly, you need to first get the response function (response vs wavelength) of the filters + CCD of your camera at each wavelength that you are using.  You do this by imaging without the sample.  Then repeat with the sample and divide "with" by "without", where "with" is the output in the R, G, or B channel that has the most response in the "without" case.</p>

CC BY-SA 3.0
2016-03-29T20:53:37.513Z
Is that only because I won't have the coefficients a, b, and c? What if I did? Or are you saying that I surely won't?
Brian Gawlik
CC BY-SA 3.0
2016-03-31T15:54:50.447Z
These coefficients are not to be found in the image files, but I suppose you could look them up if  you know the camera used and light levels etc.  However, in the image file there are the individual values of aR, bG, and cB,  indeed, you already have 3 separate greyscale images of the scene.
eshaya
CC BY-SA 3.0
2016-03-29T16:39:36.693Z
2016-04-26T15:43:54.427Z
2016-04-26T15:43:54.427Z
eshaya
<p>OP here. For those who care, I think I figured out a solution; for my particular situation at least. </p>

<p>I'm pretty sure that as long as I use reference images for each wavelength I will be able to measure the reflectivity of my samples using RGB images converted to grayscale. Much like in spectrophotometry, I will be calculating the following ratio:</p>

<p><strong>sample(wav)/ref(wav) = reflect(wav)</strong></p>

<p>Where...</p>

<p><strong>sample(wav)</strong> is a grayscale pixel value as a function of wavelength for images of the sample.</p>

<p><strong>ref(wav)</strong> is a grayscale pixel value as a function of wavelength for images of the reference.</p>

<p><strong>reflect(wav)</strong> is the reflectivity of the sample as a function of wavelength for an arbitrary pixel.</p>

<p>FYI my samples are Silicon wafers and the reference I will be using will be an Aluminum mirror. Both are specularly reflective.</p>

<p>Now I will attempt to prove that this makes sense mathematically...</p>

<p>Let's say at a particular wavelength there is some intensity reflected from the sample, <strong>I_sample(wav)</strong>, and some intensity reflected from the reference, <strong>I_ref(wav)</strong>. We want to measure something proportional to each of these intensities at each wavelength. Let's see if the RGB camera is going to screw us over or not...</p>

<p>The red, green, and blue filters each have there own transmission as a function of wavelength. Let's call these R(wav), G(wav), and B(wav). Thus the R,G,B values (0-255) that get recorded for the sample are proportional to R(wav)*I_sample(wav), G(wav)*I_sample(wav), B(wav)*I_sample(wav). And similarly for the reference we have R(wav)*I_ref(wav), G(wav)*I_ref(wav), B(wav)*I_ref(wav). </p>

<p>Converting these images to grayscale involves weighting the R, G, B values in the following manner: gray = aR+bG+cB. Which will give us the following grayscale pixel values:</p>

<p><strong>sample(wav):</strong> a x R(wav) x I_sample(wav) + b x G(wav) x I_sample(wav) + c x B(wav) x I_sample(wav)</p>

<p><strong>ref(wav):</strong> a x R(wav) x I_ref(wav) + b x G(wav) x I_ref(wav) + c x B(wav) x I_ref(wav)</p>

<p>A factor of <strong>a<em>R(wav) + b</em>G(wav) + c*B(wav)</strong> can be pulled out of each, and then if the ratio of <strong>sample(wav)/ref(wav)</strong> is calculated the common terms cancel leaving <strong>I_sample(wav)/I_ref(wav)</strong>. This is reflectivity! Voila! </p>

<p>Hope this is correct... I have to go, but will continue to think about this, and will edit if I realize anything is wrong. </p>

CC BY-SA 3.0
2016-05-05T13:48:01.017Z
I know I'm a little late to the party, but I found this question interesting.  You are shooting the images in an otherwise light-free room?  Meaning, there are no other light sources which could contaminate your spectral samples?
EastOfJupiter
CC BY-SA 3.0
2016-05-07T01:31:30.520Z
Yes, of course.
Brian Gawlik
CC BY-SA 3.0
2016-04-06T20:02:49.810Z
2016-04-07T01:07:18.240Z
2016-04-07T01:07:18.240Z
Brian Gawlik
<p>FYI my application is not astronomy related, but I know astronomy folks have a lot of knowledge of photodetection and spectrometry instrumentation, so I am seeking this community's help. </p>

<p>I'm interested in doing both spectral and RGB imaging. I'm wondering if I can do both with just an RGB CMOS camera... The way I would approach the spectral imaging is to illuminate my sample with monochromatic light one wavelength at a time and then convert the images to grayscale. Each grayscale image would represent the intensity of light reflecting from my sample at a particular wavelength. I would love for this to work, but I am doubtful that the converted image will actually represent what a grayscale camera would record. </p>

<p>Bit of an odd scenario... Wasn't sure how to search the web for this. Any help is appreciated! Thanks!</p>

CC BY-SA 3.0
2016-03-29T07:20:58.997Z
What kind of sample do you have? If it was just reflecting light, your approach might work. Yet, if your sample emits light (i.e. absorbs your monochromatic light and emits it at a different wavelength), potentially also in a different position, you would not see the true spectral image.
engineer
CC BY-SA 3.0
2016-03-29T07:33:38.670Z
You will have to correct for the spectral response of your tunable light source, and for the spectral response of your detector. In a sense you will want to look at the differential response of your system with and without the target, or rather between your target and a reference target.
Conrad Turner
CC BY-SA 3.0
2016-03-29T13:10:18.377Z
The usual conversion for RGB to greyscale follows a formula like: Y = 0.216R + 0.715G + 0.072B https://en.wikipedia.org/wiki/Grayscale Unless you're extremely lucky in filter choice, I doubt you'll get the same answer as from conversion of a single RGB camera image.
Wayfaring Stranger
CC BY-SA 3.0
2016-03-29T20:46:11.557Z
@engineer My samples are silicon wafers. They are only reflecting, not fluorescing.
Brian Gawlik
CC BY-SA 3.0
2016-03-29T20:48:57.073Z
@ConradTurner I will certainly be using a reference. Probably an aluminum mirror. This is standard practice in spectrophotometry; it will account for the spectral response of the tunable light source and the spectral response of grayscale detectors, although I'm not sure it will account for the RGB nature of the camera in this particular case...
Brian Gawlik
CC BY-SA 3.0
2016-03-29T20:51:42.247Z
@WayfaringStranger Thanks! Interesting formula there. Yeah, I'm really doubting the ability to go through this conversion and then back... Maybe it's possible mathematically? I'm not sure, but even if it is I probably won't know the exact formula my camera uses.
Brian Gawlik
<photography><spectrometry>
Photodetector Question: Does converting an RGB image to grayscale produce the same result as using a grayscale image detector?
Brian Gawlik
# Photodetector Question: Does converting an RGB image to grayscale produce the same result as using a grayscale image detector?

(Asked by: username_0 on 2016-03-28)

FYI my application is not astronomy related, but I know astronomy folks have a lot of knowledge of photodetection and spectrometry instrumentation, so I am seeking this community's help.

I'm interested in doing both spectral and RGB imaging. I'm wondering if I can do both with just an RGB CMOS camera... The way I would approach the spectral imaging is to illuminate my sample with monochromatic light one wavelength at a time and then convert the images to grayscale. Each grayscale image would represent the intensity of light reflecting from my sample at a particular wavelength. I would love for this to work, but I am doubtful that the converted image will actually represent what a grayscale camera would record.

Bit of an odd scenario... Wasn't sure how to search the web for this. Any help is appreciated! Thanks!

**Tags:** photography, spectrometry
> **Comments:**
> **username_1**: What kind of sample do you have? If it was just reflecting light, your approach might work. Yet, if your sample emits light (i.e. absorbs your monochromatic light and emits it at a different wavelength), potentially also in a different position, you would not see the true spectral image.  
> **username_2**: You will have to correct for the spectral response of your tunable light source, and for the spectral response of your detector. In a sense you will want to look at the differential response of your system with and without the target, or rather between your target and a reference target.  
> **username_3**: The usual conversion for RGB to greyscale follows a formula like: Y = 0.216R + 0.715G + 0.072B https://en.wikipedia.org/wiki/Grayscale Unless you're extremely lucky in filter choice, I doubt you'll get the same answer as from conversion of a single RGB camera image.  
> **username_0**: @engineer My samples are silicon wafers. They are only reflecting, not fluorescing.  
> **username_0**: @ConradTurner I will certainly be using a reference. Probably an aluminum mirror. This is standard practice in spectrophotometry; it will account for the spectral response of the tunable light source and the spectral response of grayscale detectors, although I'm not sure it will account for the RGB nature of the camera in this particular case...  
> **username_0**: @WayfaringStranger Thanks! Interesting formula there. Yeah, I'm really doubting the ability to go through this conversion and then back... Maybe it's possible mathematically? I'm not sure, but even if it is I probably won't know the exact formula my camera uses.  

---

## 2 answers

### Answer by username_4 on 2016-03-29. Score: 2

Really, all cameras/detectors are greyscale detectors. Every pixel in a CCD detector puts out a single number for the number of photons it detected. To create an RGB image you need three filters. If you have 3 detectors, you can put a different filter in front of each and get 3 numbers at once. If you have 1 detector, then you take 3 measurements with a different filter each time. To create the color image, one combines these values but you have freedom to weight them as you like. Typically, one tries to imitate the sensitivity of the eye, but that is a complicated issue since the sensitivity of the eye to different colors changes with total intensity and the filters can not exactly reproduce the eye's bandpasses. So, there is no right way to do this. Some people like red more than blue, so they weight the R-band more. Once, you get aR+bG+cB, you loose the information you need to derive R, G, and B separately.

So, to do your experiment properly, you need to first get the response function (response vs wavelength) of the filters + CCD of your camera at each wavelength that you are using. You do this by imaging without the sample. Then repeat with the sample and divide "with" by "without", where "with" is the output in the R, G, or B channel that has the most response in the "without" case.

> **Comments:**
> **username_0**: Is that only because I won't have the coefficients a, b, and c? What if I did? Or are you saying that I surely won't?  
> **username_4**: These coefficients are not to be found in the image files, but I suppose you could look them up if  you know the camera used and light levels etc.  However, in the image file there are the individual values of aR, bG, and cB,  indeed, you already have 3 separate greyscale images of the scene.  

---

### Answer by username_0 on 2016-04-06. Score: 1

OP here. For those who care, I think I figured out a solution; for my particular situation at least.

I'm pretty sure that as long as I use reference images for each wavelength I will be able to measure the reflectivity of my samples using RGB images converted to grayscale. Much like in spectrophotometry, I will be calculating the following ratio:

**sample(wav)/ref(wav) = reflect(wav)**

Where...

**sample(wav)** is a grayscale pixel value as a function of wavelength for images of the sample.

**ref(wav)** is a grayscale pixel value as a function of wavelength for images of the reference.

**reflect(wav)** is the reflectivity of the sample as a function of wavelength for an arbitrary pixel.

FYI my samples are Silicon wafers and the reference I will be using will be an Aluminum mirror. Both are specularly reflective.

Now I will attempt to prove that this makes sense mathematically...

Let's say at a particular wavelength there is some intensity reflected from the sample, **I\_sample(wav)**, and some intensity reflected from the reference, **I\_ref(wav)**. We want to measure something proportional to each of these intensities at each wavelength. Let's see if the RGB camera is going to screw us over or not...

The red, green, and blue filters each have there own transmission as a function of wavelength. Let's call these R(wav), G(wav), and B(wav). Thus the R,G,B values (0-255) that get recorded for the sample are proportional to R(wav)\*I\_sample(wav), G(wav)\*I\_sample(wav), B(wav)\*I\_sample(wav). And similarly for the reference we have R(wav)\*I\_ref(wav), G(wav)\*I\_ref(wav), B(wav)\*I\_ref(wav).

Converting these images to grayscale involves weighting the R, G, B values in the following manner: gray = aR+bG+cB. Which will give us the following grayscale pixel values:

**sample(wav):** a x R(wav) x I\_sample(wav) + b x G(wav) x I\_sample(wav) + c x B(wav) x I\_sample(wav)

**ref(wav):** a x R(wav) x I\_ref(wav) + b x G(wav) x I\_ref(wav) + c x B(wav) x I\_ref(wav)

A factor of **a*R(wav) + b*G(wav) + c\*B(wav)** can be pulled out of each, and then if the ratio of **sample(wav)/ref(wav)** is calculated the common terms cancel leaving **I\_sample(wav)/I\_ref(wav)**. This is reflectivity! Voila!

Hope this is correct... I have to go, but will continue to think about this, and will edit if I realize anything is wrong.

> **Comments:**
> **username_5**: I know I'm a little late to the party, but I found this question interesting.  You are shooting the images in an otherwise light-free room?  Meaning, there are no other light sources which could contaminate your spectral samples?  
> **username_0**: Yes, of course.  

---

