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.

localtonemap

Render HDR image for viewing while enhancing local contrast

Syntax

rgb = localtonemap(hdr)
rgb = localtonemap(hdr,Name,Value,...)

Description

example

rgb = localtonemap(hdr) converts the high dynamic range image hdr to a lower dynamic range image, rgb, suitable for display. localtonemap uses a process called tone mapping while preserving its local contrast.

rgb = localtonemap(hdr,Name,Value,...) performs tone mapping where parameters control various aspects of the operation. Parameter names can be abbreviated.

Examples

collapse all

Load a high dynamic range image.

HDR = hdrread('office.hdr');

Apply local tone mapping with a small amount of dynamic range compression.

RGB = localtonemap(HDR, 'RangeCompression', 0.1);

Display the resulting tone-mapped image.

imshow(RGB)

Repeat the operation but, this time, accentuate the details in the image.

RGB = localtonemap(HDR, ...
                  'RangeCompression', 0.1, ...
                  'EnhanceContrast', 0.5);

Display the resulting tone-mapped image with increased details.

imshow(RGB)

Input Arguments

collapse all

High dynamic range image, specified as a real, nonsparse, m-by-n or m-by-n-by-3 matrix of class single.

Data Types: single

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:

collapse all

Amount of compression applied to the dynamic range of the HDR image, specified as a numeric scalar in the range [0,1].

ValueDescription
0Minimum compression, which consists in only remapping the middle 99% intensities to a dynamic range of 100:1 followed by gamma correction with an exponent of 1/2.2.
1Maximum compression using local Laplacian filtering.

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

Amount of local contrast enhancement applied, specified as a numeric scalar. Value must be in the range [0,1].

ValueDescription
0No change to local contrast
1Maximum local contrast enhancement

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

Output Arguments

collapse all

Tone-mapped image, returned as an RGB image.

Algorithms

localtonemap uses local Laplacian filtering in logarithmic space to compress the dynamic range of HDR while preserving or enhancing its local contrast. The 99% middle intensities of the compressed image are then remapped to a fixed 100:1 dynamic range to give the output image a consistent look. localtonemap then applies gamma correction to produce the final image for display.

Introduced in R2016b

Was this topic helpful?