Available in the LEADTOOLS Imaging toolkit. |
RemapHue method (Main Control)
Visual Basic
example
Visual
C++ 4.0 example
Syntax short RemapHue (BOOL bUseMaskTable, BOOL bUseHTable, BOOL bUseSTable, BOOL bUseVTable);
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<255 and
0<=y<x
or in the HSV color space
HSV(0,x,x) where:
0<=x<=255
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 nUseMaskTable set to FALSE and bUseVTable set to TRUE will let you change the Value of each color.
This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.
See Also
Elements: MaskTable property, HTable property, STable property, VTable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method