Tuesday, August 10, 2010

Adding Violet to the Spectrum

Taking a picture of a spectrum with a digital camera doesn't guarantee that you will capture a complete spectrum. Some colors like yellow and blue do not show up because the power spectrum of the light is fairly uniform over the range of wavelengths present. I narrowed the slit on my spectrometer and took a picture and as you can see the colors yellow and cyan are muted while magenta is missing entirely.

The reason appears to be that the camera is not sensitive enough to red light below a wavelength of 500 nm. Each pixel of an RGB image has values of R, G and B ranging between 0 and 255 for the colors red, green and blue respectively. One can add a synthetic violet to the image by replacing the R value by 4R if the B value is greate than the R value but only to those portions of the image that you want to correct. This effectively makes the R image more sensitive to violet light. The changes are shown below.

In general one probably needs to be more careful about conditions and changes made to the image. The change worked for this example but the same changes would also alter other colors like the white in the scale above the spectrum.

No comments: