For most of us, taking bad pictures is incredibly easy. Band-Aid or remedy, digital post-processing can involve altering the photographed scene itself. Say you're trekking through the mountains taking photos of the horizon, or you're walking down the street and catch a beautiful perspective of the city, or it's finally the right time to put the new, expensive phone camera to good use and capture the magic of this riverside... Just why do all the pictures look so bad? They're all foggy! It's not that you're a bad photographer---OK, maybe you are---but that you've stumbled on a characteristic problem in outdoor photography: haze.
What is haze? Technically, haze is scattered light, photons bumped around by the molecules in the air and deprived of their original color, which they got by bouncing off the objects you are trying to see. The problem gets worse with distance: the more the light has to travel, the more it gets scattered around, and the more the scene takes that foggy appearance.
What can we do? What can possibly help our poor photographer? Science, of course.
Wolfram recently attended and sponsored the 2014
IEEE International Conference on Image Processing (ICIP), which ended October 30 in Paris. It was a good occasion to review the previous years' best papers at the conference, and we noticed
an interesting take on the haze problem proposed by Chen Feng, Shaojie Zhuo, Xiaopeng Zhang, Liang Shen, and Sabine Süsstrunk [1]. Let's give their method a try and implement their "dehazing" algorithm.
The core idea behind the paper is to leverage the different susceptibilities of the light being scattered, which depend on the wavelength of the light. Light with a larger wavelength, such as red light, is more likely to travel around the dust, the smog, and all the other particles present in the air than shorter wavelength colors, like green or blue. Therefore, the red channel in an image carries better information about the non-hazy content of the scene.
But what if we could go even further? What prevents us from using the part of the spectrum slightly beyond the visible light? Nothing really---save for the fact we need an infrared camera.
Provided we are well equipped, we can then use the four channels of data (near infrared, red, green, and blue) to estimate the haze color and distribution and proceed to remove it from our image.