Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

imreducehaze

Reduce atmospheric haze

Syntax

[D,T,L] = imreducehaze(X)
[___] = imreducehaze(X,amount)
[___] = imreducehaze(___,Name,Value)

Description

example

[D,T,L] = imreducehaze(X) reduces atmospheric haze in X, which is an RGB or grayscale image. D is the dehazed image. T contains an estimate of the haze thickness at each pixel. L is the estimated atmospheric light, which represents the value of the brightest non-specular haze.

[___] = imreducehaze(X,amount) reduces atmospheric haze in image X, where amount specifies the amount of haze removed.

example

[___] = imreducehaze(___,Name,Value) changes the behavior of the dehazing algorithm using name-value pairs.

Examples

collapse all

Read hazy image into the workspace.

A = imread('foggysf1.jpg');

Reduc the haze and display the result along side the original image.

B = imreducehaze(A);
figure, imshowpair(A, B, 'montage')

Read hazy image into the workspace.

A = imread('foggysf2.jpg');

Reduce 90% of the haze using the approxdcp method.

B = imreducehaze(A, 0.9, 'method', 'approxdcp');

Display the result along side the original image.

figure, imshowpair(A, B, 'montage')

Read hazy image into the workspace.

A = imread('foggyroad.jpg');

Reduce haze in the image using default parameter values.

[~, T] = imreducehaze(A);

Display the result along side the original image.

figure, imshowpair(A, T, 'montage')

The haze thickness provides a rough approximation of the depth of the scene, defined up to an unknown multiplication factor. Add eps to avoid log(0).

D = -log(1-T+eps);

For display purposes, scale the depth so that it is in [0,1].

D = mat2gray(D);

Display the original image next to the estimated depth in false color.

figure
subplot(1,2,1)
imshow(A), title('Hazy image')
subplot(1,2,2)
imshow(D), title('Depth estimate')
colormap(gca, hot(256))

Input Arguments

collapse all

Input RGB or grayscale image, specified as a real, non-sparse, m-by-n-by-3 (RGB) or m-by-n (grayscale) array.

Data Types: single | double | uint8 | uint16

How much haze to remove, specified as a scalar in the range [0,1]. When amount is 1 (the default), imreducehaze reduces the maximum amount of haze. When the amount is 0, the input image is unchanged.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: B = imreducehaze(A, 0.9, 'method', 'approxdcp');

collapse all

Technique used to reduce haze, specified as 'simpledcp' or 'approxdcp'. The 'simpledcp' method employs a per-pixel dark channel prior to haze estimation and quadtree decomposition to compute the atmospheric light. 'approxdcp' uses both per-pixel and spatial blocks when computing the dark channel prior to haze reduction and does not use quadtree decomposition.

Data Types: char | string

Maximum value to be treated as haze, specified a 1-by-3 vector (for RGB images) or a scalar (for grayscale images). Values must be less than or equal to 1. When not specified, this value depends on the value of 'method'. For 'approxdcp', the brightest 0.1% pixels of the dark channel are considered to estimate the value. For 'simpledcp', imreducehaze uses quadtree decomposition to compute the value.

Data Types: double

Post-processing technique to improve image contrast, specified as 'global' (default), 'boost', or 'none'.

Data Types: char | string

Amount of per-pixel gain to apply as post-processing, specified as a scalar in the range [0,1]. This parameter is only allowed if 'ContrastEnhancement' is set to 'boost'.

Data Types: double

Output Arguments

collapse all

Dehazed image, returned as numeric array.

Estimate of haze thickness at each pixel, returned as a numeric array.

Estimated atmospheric light, returned as a numeric array. L represents the brightest non-specular haze.

Tips

  • Atmospheric light values should be greater than 0.5 for better results

  • Use contrast enhancement as none for applying user’s customized contrast enhancement technique

  • Amount value should be near to 1 for reducing more haze.

  • Reduce Amount value if the result looks color distortion

Algorithms

Function imreducehaze uses two different dehazing methods, simpledcp and approxdcp, to reduce haze in an image. These two dehazing techniques can be described in five main steps

  • Atmospheric light Estimation using dark channel prior

  • Estimation of transmission map

  • Refine the estimated transmission map

  • Restoration

  • Post processing

The widely used model to describe the formation of hazy image [1] is

I(x) = J(x)t(x)+A(1-t(x))

Where I is the observed intensity, J is the scene radiance, A is atmospheric light, and t is the transmission medium describing the portion of light that is not scattered and reaches the camera. With the estimation of the transmission map t and atmospheric light A we can recover scene radiance J.

J(x) = (I(x)-A)/(max(t(x), t0)) + A

The Approximate Dark Channel Prior (ApproxDCP) method [1] uses dark channel to reduce haze from a single hazy image. The dark channel is based on the key observation that most local patches in outdoor haze-free images contain some pixels whose intensity is very low in at least one color channel. Atmospheric light is estimated using the top 0.1% bright pixels of dark channel. The transmission map is then estimated using dark channel and atmospheric light. This method used a guided filter to refine the estimated transmission map. After getting atmospheric light and transmission map, scene radiance is recovered using inverse Koschmieder law. The resulting dehazed image has low contrast (dim) so contrast enhancement as post-processing step is used to improve the contrast.

The Simple Dark Channel Prior (SimpleDCP) method uses dark channel to reduce haze from the image. The dark channel can be estimated by considering minimum intensity across R, G, B channels. Atmospheric light is estimated using quadtree decomposition [2] of dark channel. Then estimation of transmission map using dark channel is done. The guided filter is used to refine the transmission map. The scene radiance is recovered using estimated atmospheric light and transmission map. Contrast enhancement technique is applied as a post processing step to improve contrast of an image. The major difference between SimpleDCP and ApproxDCP is the estimation of dark channel and atmospheric light.

References

[1] He, Kaiming. "Single Image Haze Removal Using Dark Channel Prior." Thesis, The Chinese University of Hong Kong, 2011.

[2] Dubok, et al. "Single Image Dehazing with Image Entropy and INformation Fidelity." ICIP, 2014.

Introduced in R2017b

Was this topic helpful?