tonemap
Render high dynamic range image for viewing
Description
uses name-value arguments to control various aspects of the tone mapping. RGB
= tonemap(HDR
,Name=Value
)
Examples
Display High Dynamic Range Image
This example shows how to display a high dynamic range (HDR) image. To view an HDR image, you must first convert the data to a dynamic range that can be displayed correctly on a computer.
Read a high dynamic range (HDR) image using hdrread
. If you try to display the HDR image, notice that it does not display correctly.
hdr_image = hdrread("office.hdr");
imshow(hdr_image)
Convert the HDR image to a dynamic range that can be viewed on a computer, using the tonemap
function. This function converts the HDR image into an RGB image of data type uint8
.
rgb = tonemap(hdr_image); whos
Name Size Bytes Class Attributes hdr_image 665x1000x3 7980000 single rgb 665x1000x3 1995000 uint8
Display the RGB image.
imshow(rgb)
Input Arguments
HDR
— High dynamic range image
m-by-n-by-3 array
High dynamic range image, specified as an m-by-n-by-3 array of nonnegative numbers.
Data Types: single
| double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: RGB = tonemap(HDR,AdjustLightness=[0.05 0.95])
adjusts the
lightness of the rendered image such that pixel values between 0.05
and
0.95
linearly map to display values between 0 and 1.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: RGB = tonemap(HDR,"AdjustLightness",[0.05 0.95])
AdjustLightness
— Overall lightness of the rendered image
2-element vector
Overall lightness of the rendered image, specified as a two-element
vector. The vector takes the form [low high]
, where low
and high
are
luminance values of the low dynamic range image, in the range (0,
1]. These values are passed to imadjust
.
Data Types: double
AdjustSaturation
— Saturation of colors in the rendered image
1
(default) | positive scalar
Saturation of colors in the rendered image, specified as a positive scalar. When the value is greater than 1, the colors are more saturated. When the value is in the range (0, 1], colors are less saturated.
Data Types: double
NumberOfTiles
— Number of tiles used during adaptive histogram equalization
[4 4]
(default) | 2-element vector of positive integers
Number of tiles used during the adaptive histogram equalization part of the tone mapping
operation, specified as a 2-element vector of positive integers. The vector takes the
form [rows cols]
, where rows
and
cols
specify the number of rows and columns of tiles. Both
rows
and cols
must be at least 2. The total
number of image tiles is equal to rows*cols
. A larger number of
tiles results in an image with greater local contrast.
Data Types: double
Output Arguments
RGB
— Low dynamic range image
m-by-n-by-3 array
Low dynamic range image, returned as an m-by-n-by-3 array.
Data Types: uint8
Version History
Introduced in R2007b
See Also
adapthisteq
| hdrread
| stretchlim
| tonemapfarbman
| makehdr
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)