RemapHue method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int RemapHue (bool bUseMaskTable, bool bUseHTable, bool bUseSTable, bool bUseVTable);

Delphi Syntax

Function RemapHue (bUseMaskTable: Boolean; bUseHTable: Boolean; bUseSTable: Boolean; bUseVTable: Boolean): Integer;

Overview

Refer to Changing Brightness and Contrast.

Remarks

Uses a lookup table to change a bitmap's hue values. The saturation and value tables change S and V values only if a particular hue value is marked as non-zero in the MaskTable property.

This method can be used to change a range of colors to another range of colors. For example, it could be used to change all red pixels to any color, where a red pixel can have any brightness (V) and any amount of white (saturation). A red pixel in this case would be

RGB (x,y,y) where:

0<=x<( RemapHueTablesSize –1) and

0<=y<x

or in the HSV color space

HSV (0,x,x) where:

0<=x<= (RemapHueTablesSize -1)

The MaskTable [i] lookup table identifies which values in the HTable [i] are valid. If a MaskTable [i] value is 0, then the corresponding value in the HTable [i] is ignored. If a MaskTable [i] value is non-zero, then the corresponding value in the HTable [i] is used. For example, if a pixel has a hue value of 240 and MaskTable [240] is nonzero, then the hue value of 240 is replaced with HTable [240]. Traditionally, hue ranges from 0 to 359. For the lookup table, the range of 0 to 359 is remapped to a range of 0..255. For example,

 

Color

Hue (0..359)

Hue (0..255)

Red

0

0

Green

120

85

Blue

240

170

Use HSV_HfromRGB, HSV_SfromRGB, HSV_VfromRGB, and RGBfromHSV methods to convert between RGB and HSV color space.

Calling this method with bUseMaskTable set to FALSE and bUseSTable set to TRUE will let you change the Saturation of each color. Similarly, calling this method with bUseMaskTable set to FALSE and bUseVTable set to TRUE will let you change the Value of each color.

This method supports 48 and 64-bit colored images.

This method does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if you are working on signed data image.

See Also

Elements:

MaskTable property, HTable property, STable property, VTable property, RemapHueTablesSize property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics:

Raster Images: Modifying Intensity Values

 

Using Color Values in LEADTOOLS