"Dark Channel" haze removal?

Moderator: jsachs

Post Reply
TTait
Posts: 9
Joined: May 11th, 2013, 11:12 am
What is the make/model of your primary camera?: Lumix G5

"Dark Channel" haze removal?

Post by TTait »

Is there a way to do "Dark Channel" haze removal in PWP? See this for details:
http://research.microsoft.com/en-us/um/ ... he/cvpr09/

It seems lightroom has recently added this.

Tim
jsachs
Posts: 4447
Joined: January 22nd, 2009, 11:03 pm

Re: "Dark Channel" haze removal?

Post by jsachs »

There is no way I can think of the use the existing features of PWP to do haze removal. I have seen the paper describing this particular method before as it is several years old as well as quite as few others, but have never gotten around to trying any of them as they are all fairly complicated and most are not foolproof. It is however a promising research direction for the future. From an artistic standpoint, adding haze could be just as interesting.
Jonathan Sachs
Digital Light & Color
den
Posts: 861
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: "Dark Channel" haze removal?

Post by den »

Apologies... ...just could not resist the challenge...

1) Starting image from web page:
tiananmen1.jpg
tiananmen1.jpg (46.45 KiB) Viewed 8130 times
2) Using the Color Balance transform: expanded to full dynamic range and removed color casts from the Black and White points:
tiananmen1-1_ClrBal_FR.jpg
tiananmen1-1_ClrBal_FR.jpg (53.99 KiB) Viewed 8124 times
3) Applied a modified SNS-HDR Night tone-mapping preset to the resulting 2) image...
4) increased local contrast image areas [shadows, mid-tones, and highlights] to preference using the BrightnessCurve-DetailControl and Sharpen transforms and finalized overall tone/contrast/saturation:
tiananmen1-1_ClrBal_FR-HDR_1x1-night.jpg
tiananmen1-1_ClrBal_FR-HDR_1x1-night.jpg (90.87 KiB) Viewed 8121 times
Wonder if the above would be suitable for the full sized original image rather than the posted 600x450 starting image version. I believe I could essentially duplicate the SNS-HDR tone-mapping of step 3) using PWP but it would be very manually intensive using masks, Stack Images with Brightness/Density Curves, and perhaps the Zone Adjustment transforms but I got a bit lazy... :-)

...den...
couman
Posts: 82
Joined: April 25th, 2009, 8:44 am

Re: "Dark Channel" haze removal?

Post by couman »

Seems like a little LCE might be a good step in the right direction
tomczak
Posts: 1431
Joined: April 25th, 2009, 12:56 am
What is the make/model of your primary camera?: Fuji X-E2
Contact:

Re: "Dark Channel" haze removal?

Post by tomczak »

Going by the abstract : "...most local patches in outdoor haze-free images contain some pixels whose intensity is very low in at least one color channel.", perhaps something like this could be exploited in PWP:

1) To map the haze:

a) Extract HSV-S channel to highlight pixels with low value in at least one RGB - I think this should work because HSV-S = (max(R,G,B) - min(R,G,B)) / max(R,G,B)

b) Blur with e.g. bilateral sharpen to identify 'patches' containing some pixels of high contrast (i.e. haze-free areas). Bilateral sharpen can threshold-protect steep transitions between haze and no-haze areas (e.g. the leaves on the hazy background in the original link). I tried other things such as subtracting median blur from gaussian blur trying to separate patches of high variance in pixel saturation (i.e. haze-free), but I'm still not sure what works best.

2) To reduce the haze

a) Use 1) as a mask in Levels and Color and increase contrast, saturation and reduce bluishness of the haze. Self filtering the image may be be another technique - I'm sure there are some others.

It seems to work reasonably well on the sample images, but I'm not sure how relevant it is to the actual "Dark Channel" removal technique and if it is much worse. One problem I can see is that since a channel needs to be extracted and its blurred version used as a mask, I don't know how to automate it in a workflow.

Cheers!
Maciej Tomczak
Phototramp.com
jsachs
Posts: 4447
Joined: January 22nd, 2009, 11:03 pm

Re: "Dark Channel" haze removal?

Post by jsachs »

If you read the entire article, there is a lot more processing they do to refine the so-called dark channel prior image which is itself quite easy to compute. This additional processing is necessary to avoid halos and is complicated and time consuming. Another general other problem with haze removal is that in areas of heavy haze, there is much less information and when you remove the haze you then get a lot of noise. Most of the haze removal techniques therefore limit the amount of haze they remove. The more successful algorithms - and there are many alternatives to dark channel prior - are complicated and all have difficulties with some kinds of images. None are documented in enough detail to make implementation straightforward.
Jonathan Sachs
Digital Light & Color
TTait
Posts: 9
Joined: May 11th, 2013, 11:12 am
What is the make/model of your primary camera?: Lumix G5

Re: "Dark Channel" haze removal?

Post by TTait »

This is what the DXO "Clearview" does... yours looks as good I think.
Attachments
tiananmen1_DxO_1.jpg
tiananmen1_DxO_1.jpg (80.15 KiB) Viewed 7890 times
Robert Schleif
Posts: 354
Joined: May 1st, 2009, 8:28 pm

Re: "Dark Channel" haze removal?

Post by Robert Schleif »

In a neutral haze, the further an object is from the camera, the more light from the object will be scattered out of the path to the camera and at the same time, the more scattered light will be will be added the same light path. Furthermore, on one hand more blue than red from an object will be scattered out of the path to the camera so distant objects could become redder (setting sun). On the other hand, the light that is scattered into the path to an object will be more blue than the ambient light. Overall however, experience shows that the former color effect is greater than the latter. Thus, one way to reduce haze is to subtract white, color correct, and then multiply appropriately, performing these transformations through a mask approximately proportional to distance. In the case of the example being used, this can be a gradient mask from approximately lower left to upper right. Without taking the time to fiddle and get amounts just right and also ignoring the distant building, this series of transformations (plus LCE) gave me the following image.
Attachments
Chinese.jpg
Chinese.jpg (61.95 KiB) Viewed 7769 times
jsachs
Posts: 4447
Joined: January 22nd, 2009, 11:03 pm

Re: "Dark Channel" haze removal?

Post by jsachs »

As you say, if you know how much haze is present at each pixel and what the haze color is, then it is a relatively simple matter to subtract out the haze and renormalize the image. The hard part is identifying where the image is hazy and how much as opposed to where it just happens to be the same color as the haze and not have much detail. It gets particularly difficult when you have a complicated foreground with no haze overlapping the hazy background (for example foliage) since you have to accurately identify the edges of the different regions to create an accurate haze mask. The paper on the dark channel proposes a method for doing this automatically, but it is neither foolproof nor computationally efficient.
Jonathan Sachs
Digital Light & Color
Post Reply