ImageGear for C and C++ on Windows v20.0 - Updated
IG_IP_transform_with_LUT
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_transform_with_LUT

This function transforms the pixel values of the image referenced by hIGear, using a LUT.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_transform_with_LUT (
        HIGEAR hIGear, 
        LPAT_RECT lpRect,
        LPAT_PIXEL lpLUTr, 
        LPAT_PIXEL lpLUTg, 
        LPAT_PIXEL lpLUTb, 
        AT_MODE nColorMode 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image to transform.
lpRect LPAT_RECT Rectangular portion of the image to process; set to NULL for entire image. Before ImageGear performs this operation, it will check to see if an internal flag has been set to TRUE to make a mask active for this HIGEAR image. If a mask is active, and a valid pointer to a mask can be found, ImageGear will override the settings passed to this structure in favor of the non-rectangular ROI defined by the mask.
lpLUTr LPAT_PIXEL Far pointer to a user-supplied Look-Up Table for transforming the red component, or for transforming the pixel value if the image is less than 24-bit.
lpLUTg LPAT_PIXEL Far pointer to a user-supplied Look-Up Table for transforming the green component, or for transforming the pixel value if the image is 24-bit.
lpLUTb LPAT_PIXEL Far pointer to a user-supplied Look-Up Table for transforming the blue component, or for transforming the pixel value if the image is 24-bit.
nColorMode AT_MODE A variable of type AT_MODE (IG_COLOR_COMP_) that tells which color channel to use, or to use all three.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++, with the following restrictions:
Bits per channel must be less than or equal to 8.

Sample:

Image Processing, FlashPix

Example:

 
Copy Code
HIGEAR hIGear;         /* HIGEAR handle of image    */
AT_PIXEL LUTred[256];  /* Look up pixels, or red if 24-bit, here */
AT_PIXEL LUTgreen[256];/* Look up green if 24-bit, here   */
AT_PIXEL LUTblue[256]; /* Look up blue if 24-bit, here    */
IG_IP_transform_with_LUT ( hIGear, (LPAT_PIXEL)&LUTred,(LPAT_PIXEL)&LUTgreen,
(LPAT_PIXEL)&LUTblue, IG_COLOR_COMP_RGB );

Remarks:

The pixels from hIGear are used as indices into the LUT. The entry in the LUT at this position is placed into the new image. For 24-bit images, the three channels each have their own LUT. You can point all three LUT parameters to the same LUT. This will process all three channels the same. For 8-bit gray level images, only the lpLUTr LUT parameter is used and the pixel value replaced from the LUT is as follows and the other two are ignored.

 
Copy Code
new pixel value  = RedLUT[ old pixel value ].

This function, like other ImageGear Image Processing and Clipboard API calls, takes an AT_RECT structure as an argument, so that you can process a rectangular sub-region of an image. (See above.) However, before ImageGear performs the operation specified by this function, it will check to see if an internal flag has been set to TRUE, indicating that a mask HIGEAR should be used with the image. If the flag is set to TRUE, and a valid pointer to a mask image has been assigned, ImageGear will override the settings passed to the AT_RECT structure and use the non-rectangular ROI defined by the mask HIGEAR. To create a non-rectangular region of interest, call IG_IP_NR_ROI_to_HIGEAR_mask().

Please see the descriptions of IG_IP_NR_ROI_mask_associate() and IG_IP_NR_ROI_to_HIGEAR_mask() functions for more details.
Is this page helpful?
Yes No
Thanks for your feedback.