Dehaze equivalent in darktable or RawTherapee

Honestly dehazing is likely the wrong tool for this job. Dehazing algorithms generally need to deal with varying levels of haze because of variations in depth - now while the variation in the distance of different stars and the milkyway are gigantic, they are pretty much irrelevant because most of it is empty space.

If you want to take milkyway shots IMO stacking is your biggest friend. This will give you a relatively clean image to work with which can then be whitebalanced, pushed using curves and some form of local contrast enhancement and denoising and of course saturation boosts.

Imgur

This is the result I got doing pretty much what was described above, using a fairly cheap aps-c camera (a6000) and non exotic lens (24/1.8).

Now back on the actual dehazing thing. It’s something I wanted to do for quite some time. I take a lot of shots when paragliding or generally in the mountains and haze is pretty much always an issue. I currently solve it using either Lab curves or local white balance for the color part and curves + some form of local contrast for the luminance part of the equation, trying to reconstruct depth using painted and parametric masks. But that’s dumb manual labor.

What I want to try when I find some time is to basically use the local contrast (variance) as an estimation of depth/haze, filter it with some edge preserving filter (guided bilateral blur or something) and then use that with an auto detect (or user provided) haze color to subtract the haze.

I lack time and some familiarity with the tools to rapidly prototype the idea so of someone else wants to give it a shot, be my guest.

4 Likes

I finally got access to the latest version of Lightroom, where I played around with dehaze on @David_LaCivita’s picture.

The effect seems to suffer from the haloing that @CarVac described:

Original

LR dehaze +50

LR dehaze +100

For comparison, here is what I achieved using darktable’s equalizer module blended with a parametric mask:

And here is a side-by-side comparison of the Lightroom, darktable, and @Carmelo_DrRaw’s edit in PhotoFlow:

General thoughts:
Dehaze +100 is an extreme case that leads to haloing, however Dehaze seems to preserve the original colours better.

darktable and PhotoFlow recover some details but seem to lose a lot of the richness of the colours.

1 Like

It appears that your darktable and PhotoFlow efforts affected the foreground trees as well, which they shouldn’t.

Did you mask them off? Or was this all done without manual masking to mimic the single slider of Lightroom?

Edit: I should try it with Filmulator, which sometimes eats through haze (but will exhibit halos if abused for this purpose).

1 Like

I should make it clear that the PhotoFlow version was not done by me, but by @Carmelo_DrRaw . The original post says it was done without masking (which is why the foreground is affected): https://plus.google.com/110624611011165412718/posts/RBpURV81AVD

However, in the darktable version I used a parametric mask, in which I attempted to capture haze by varying the L and b channels. The foreground is relatively unchanged in that version (at least when compared to the original rather than dehazed versions). I also managed to recover some colour using the colour correction module, it looks somewhat similar to the dehaze +50 setting:

It’s no single slider though…

1 Like

Here’s my Filmulated take on it. Do note that all the colors are changed, because that’s just what Filmulator does.

It merely moderates the overall brightness of the hazy area, lowering it mildly, while increasing local contrast, rather than explicitly subtracting out brightness.

It doesn’t really remove the haze at all, but it should be more like what you actually perceived when looking at the scene.

(settings: drama of 89, and adjusted blackpoint and whitepoint to taste)

1 Like

Yeah, the color shift is the biggest problem, otherwise Darktables Equalizer is already fairly good. If the would allow chroma control on the residual it would work much better I think.

I gave it a quick whack in Gimp with the Wavelet-Decompose plugin and a simple mask based on similarity to the haze color.


(left is the raw as I exported it from DT, right is dehazed in gimp with some simple masking at the sky and around the trees mostly because there was some fugly haloing caused by the non edge-avoiding wavelets the plugin presumably uses).

IMO the lighroom results still look the best - and that with a simple slider. :smile:

it would be really interesting to try to do something a bit more advanced with darktables edge optimized wavelets. But I guess it would be sufficiently painful to extract that code into something usable outside of darktable. :confused:

Gave it another whack, trying to fake what would happen if you could remove the residual in darktables equalizer:


This time at a slightly less extreme setting.

2 Likes

Couldn’t resist and gave it another whack this time just darktable:

  • Equalizer + Parametric Mask
  • Exposure (pushing blacks) + Parametric mask
  • Color correction + Parametric mask
  • Some velvia

IMO quite a good result and more natural looking than the Lightroom one. :smile:

7 Likes

so now we need to get the raw of the star sky to apply your technique to that :smiley:

Here you go guys. Shot this RAW the other night.

https://drive.google.com/open?id=0B_5yEC4wvHgDcW14d1lWaW9PU0k

1 Like

is it intentional that it needs a login to download the file?

No it is not. Maybe it just needs ANY login (like your own Google login) to work?

try this, it’s a shot of the Milky Way with a decent bit of haze:

https://drive.google.com/file/d/0B_5yEC4wvHgDUVJaTFZxNkJ4SkE/view?usp=sharing

hope it helps you guys figure it out. I would love to see something similar in an open-source program.

1 Like

I still would not use dehazing on the night sky. Just mask out the night sky and apply curves + whitebalance and you are mostly there, without any of the ugly artifacts introduced by more local techniques.

Another way is to create a really blury version of the image, so you basically only have the haze, then subtract that. This essentially gives you a low pass filter. You will need to readjust the brightness using some curves but this works too.

The getting rid of the haze/light pollution isn’t so much the problem, it’s getting enough signal that’s hard. And this is where stacking can help a lot as it gives you much better data to work with.

@Michael_Moreau a tip for the next night sky shot, leave to shutter open for a shorter duration, you have massive star trailing in the image. :wink:

@Michael_Moreau
That’s what I would do to to your Shot:

  • white balance (spot white balanced on the whole frame then tweaked it a bit)
  • slightly pushed the blacks
  • curves to make the dark parts a bit more dark and bring out the milkyway
  • a double dose of velvia to bring out the colors
  • pushed the low frequencies in the equalizer a bit to bring out the milkyway some more
  • denoise profiled with wavelets for chroma and non local means for luma
  • finally some RL deconvolution from G’MIC, set to exponential
3 Likes

looks even better than the LR dehaze. imho. mind to share the xmp?

There you go: http://29a.ch/tmp/IMG7492.CR2.xmp

I want to propose another sample image… :wink: Last week-end I went to the Alpago mountains in Italy, the humidity was quite high and so was the fog in the distance. I shot this picture of a paraglider with a very foggy background. I think this could be a nice test bench. I was inspired by some of the corrections suggested by @Jonas_Wagner.
Here what I applied with darktable:

  • white balance corrections
  • base curve and tone curve tweaking
  • velvia and vibrance enhancements
  • color zone tweaking to improve the greens in the lower part of the image
  • equalizer to increase clarity
  • denoise profiled (wavelet for chroma - non local means for luma)


darktable output (left) - in-camera jpeg with default settings (right)

What do you guys think? The colors recovered don’t fully convince me. Maybe I went to far with the saturation… Unfortunately I don’t have a Lightroom copy to compare its dehaze algorithm.
If you want to experiment with this image feel free to use the RAW file: https://drive.google.com/file/d/0B28JOPvq926IZllFTGlaS1VINk0/view?usp=sharing (updated).

2 Likes

Oh paragliding, I love paragliding :smile:

The file you linked is a JPEG. IMO you recovered a lot already, you are approaching the noise floor when looking at the background. So honestly I’d probably not push it any more. I probably wouldn’t push it much more. The colors you recovered are nice (to me at least). I think you should play with the saturation a bit though. IMO the sky/haze in the background is too saturated.

Did you apply @Jonas_Wagner’s xmp to the image? Your result feels very Velvia-ish to me (not a bad thing necessarily, just takes a minute for my eyes to adjust to it again). :slight_smile:

@Jonas_Wagner thank you for the comment. Sorry, I linked the wrong file! Here the CR2 file: https://drive.google.com/file/d/0B28JOPvq926IZllFTGlaS1VINk0/view?usp=sharing. Probably is exactly the saturated haze the thing that doesn’t convince me. Here an improved version, I desaturated a touch the haze:

@patdavid, I started the RAW developing from scratch bud I had a look at the @Jonas_Wagner xmp file. By the way, thank you for all the efforts you put in pixls.us, I really appreciate the new articles look and this new forum!

3 Likes