tonemap

Render high dynamic range image for viewing

Description

RGB = tonemap(HDR) converts the high dynamic range image HDR to a lower dynamic range image, RGB, suitable for display, using a process called tone mapping. Tone mapping is a technique used to approximate the appearance of high dynamic range images on a display with a more limited dynamic range.

example

RGB = tonemap(HDR,Name,Value) uses name-value pairs to control various aspects of the tone mapping.

Examples

collapse all

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 class 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

collapse all

High dynamic range image, specified as an m-by-n-by-3 array.

Data Types: single | double

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 quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: RGB = tonemap(HDR,'AdjustLightness',[0.05 0.95]);

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

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

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

collapse all

Low dynamic range image, specified as an m-by-n-by-3 array.

Data Types: uint8

Introduced in R2007b