Neil's News

Moon Photos

27 October 2009

After building last week's mount to connect my Android camera phone to my telescope, the night sky beckoned. First target, our Moon. Here's a photo of the moon taken at night:

[Moon in the night]
[Raw image.]

The problem is that the image is washed out. My cheap camera phone automatically sets the exposure time based on the total brightness. Since the majority of the field of view is outer space, the exposure is long. Thus the Moon is washed out. The colour is completely saturated at #FFFFFF, which means that no amount of contrast stretching will recover the detail.

One strategy is to decrease the number of photons. A simple solution is to slide a dark filter between the camera and the telescope's eyepiece. Optometrists give away dark filters one can insert into one's glasses after the use of iris-widening eye drops. These temporary sun glasses allow the patient to go outside without being blinded. Sliding one of these filters in front of the camera made virtually no difference. The camera's auto exposure system noticed the drop in light and simply took longer to take the photo, thus resulting in the original number of photons. So I cut one of these filters in half, stacked the halves and got the following photo:

[Moon using filters]
[Raw image.]

This is much better. The image was so dark that it maxed-out the camera's exposure time (in theory if one takes a photo in a completely dark room the camera should take forever to take the photo, but in practice it hits up against some hard-coded upper limit). The problem is that since the exposure was so long, the image is a bit blurry from atmospheric turbulence and vibration.

An alternative strategy is to increase the number of photons. The Moon is very visible during the day (though a survey from a few years ago found that the majority of Americans thought otherwise -- fortunately the universe is not a democracy). During the day the background isn't black, it's blue. Thus the camera will pick a decent exposure. Here's the resulting daytime photograph (enhanced for contrast):

[Moon in the day]
[Raw image.]

Sharp and detailed. It seems fairly clear that the daytime photo is the best of the three.

The programmers amongst you might find this code interesting:

try {
  return true;
} finally {
  return false;

The result is consistent in Java, JavaScript and Python. I wrote this snippet on a whiteboard here at Google. For the next couple of weeks engineers passing by would abruptly stop, transfixed by the paradox. Nerd sniping. I now use it during hiring interviews, if the candidate suffers a similar breakdown, I know we've got a keeper.

< Previous | Next >

Legal yada yada: My views do not necessarily represent those of my employer or my goldfish.