Inspiration for this work came from reading the fantastical books by J.R.R. Tolkien. In several of these books, including The Hobbit and The Lord of the Rings: The Fellowship of the Ring, moonlight reveals hidden doors that are not visible with ordinary sunlight. Thus, I desired to discover how moonlight was physically distinct from sunlight. Literature concerning this topic describes that moonlight consists largely of sunlight reflected off the Moon’s surface, in addition to some minor sources like starlight. It has a lower intensity than sunlight and looks bluish to humans; the blue hue is attributed to the Purkinje effect. To gain insight into how to reproduce moonlight artificially, I implemented a twofold approach. The first part dealt with creating a software program that applied image processing on an input image of an outdoor scene cast in natural sunlight to produce an output image of the same scene in moonlight. In the second part, I built a rudimentary LED flashlight with a moonlight mode using a function generator.
Photographers are able to manipulate their camera settings to make images taken in natural sunlight exhibit the appearance of moonlit scenes. Utilizing many of these same techniques, I wrote a program in Matlab to accomplish this goal. The code for this program can be found at the following link (open with Notepad to see it easily):
First, the images were white balanced; this affected the warmth and coolness of colors in the image. Next, the saturation was decreased to half of its original value, as moonlit scenes are less bright than sunlit ones. Finally, the contrast was increased to widen the difference between low and high pixel intensities. Using the default values for white balancing, calculated from averaging the RGB values, the resultant images were too bright. To remedy this, the white balancing was decreased. Two pairs of images in sunlight (original) and moonlight (calculated from program) are given below. The first pair shows an outdoor scene with a far depth of field, while the second has a near depth of field.
Many LED flashlights have a moonlight setting that is noticeably dimmer than the normal bright mode. I made my own form of this type of light source using a 10V peak-to-peak function generator and a strip of 12V LEDs. I set the frequency to 1 kHz and selected the square wave option. To start, I applied a high peak-to-peak voltage of approximately 9.4V to simulate sunlight. Next, I gradually decreased the voltage on the function generator, dimming the LEDs. Comparing a photograph of moonlight with the intensity of the LED strips, it was determined that a peak-to-peak voltage of 7.2V yielded a luster akin to moonlight. Photographs of the LEDs with an applied voltage of 9.4V peak-to peak (top) and an applied voltage of 7.2V peak-to-peak (bottom) are illustrated below.