Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_GetUserLookUpTable

Show in webframe

#include "l_bitmap.h"

L_LTIMGEFX_API L_INT L_GetUserLookUpTable (pLookupTable, uLookupLen, apUserPoint, uUserPointCount, puPointCount, uFlags)

L_UINT *pLookupTable;

/* lookup table */

L_UINT uLookupLen;

/* lookup table length */

POINT *apUserPoint;

/* array of points */

L_UINT uUserPointCount;

/* number of points in the array */

L_UINT *puPointCount;

/* pointer to a variable to be updated */

L_UINT32 uFlags;

/* flags */

Updates the lookup table, based on a curve that passes through the specified points.

Parameter

Description

pLookupTable

Pointer to the lookup table to be filled by this function. The length of the lookup table is specified in the uLookupLen parameter.

uLookupLen

Length of the lookup table pointed to by the pLookupTable parameter. Possible values are:

 

Value

Meaning

 

65536

16-bit / sample image

 

4096

12-bit / sample image

 

256

8-bit / sample image

apUserPoint

Pointer to an array of POINT structures that contain the points on the curve used to update the lookup table.

uUserPointCount

Number of points in the apUserPoint array.

puPointCount

Pointer to a variable to be updated with the number of entries in the lookup table that were actually updated.

uFlags

Reserved for future use. Must be 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function will update the lookup table array using the best curve that passes through the points specified in the apUserPoint parameter. The points in the array may be sorted or not. In most cases, this function is used with the L_RemapBitmapIntensity function.

Required DLLs and Libraries

LTIMGEFX

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64, Linux.

See Also

Functions:

L_GetFunctionalLookupTable, L_RemapBitmapIntensity, L_AdjustBitmapTint, L_GammaCorrectBitmapExt

Topics:

Changing Brightness and Contrast

 

Raster Image Functions: Changing Brightness and Contrast

 

Raster Image Functions: Modifying Intensity Values

Example

This example will brighten the loaded bitmap using the lookup table updated by the L_GetUserLookupTable function.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


#if defined (LEADTOOLS_V16_OR_LATER)
 L_INT GetUserLookupTableExample(L_VOID)
{
   L_INT nRet;
   L_UINT  LookupTable[256];  /* Array to hold lookup table*/
   BITMAPHANDLE LeadBitmap;  /*Bitmap handle to hold the loaded image */
   POINT  apUserPoint[3] = {{0,0},{128,150},{255,255}};
   /* Load the bitmap, force 24 bits per pixel */
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS)
      return nRet;
   /*Get Lookup table where the array effected by user data function */
   nRet = L_GetUserLookUpTable (LookupTable, 256,apUserPoint, 3, NULL, 0);
   if(nRet !=SUCCESS)
      return nRet;
   nRet = L_RemapBitmapIntensity (&LeadBitmap, (L_INT *)LookupTable, 256,CHANNEL_MASTER); 
   if(nRet !=SUCCESS)
      return nRet;
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL);
   if(nRet !=SUCCESS)
      return nRet;
   //free bitmap 
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);  
   return SUCCESS;
}
#else
 L_INT GetUserLookupTableExample(L_VOID)
{
   L_INT nRet;
   L_UINT  LookupTable[256];  /* Array to hold lookup table*/
   BITMAPHANDLE LeadBitmap;  /*Bitmap handle to hold the loaded image */
   POINT  apUserPoint[3] = {{0,0},{128,150},{255,255}};
   /* Load the bitmap, force 24 bits per pixel */
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS)
      return nRet;
   /*Get Lookup table where the array effected by user data function */
   nRet = L_GetUserLookUpTable (LookupTable, 256,apUserPoint, 3, NULL);
   if(nRet !=SUCCESS)
      return nRet;
   nRet = L_RemapBitmapIntensity (&LeadBitmap, (L_INT *)LookupTable, 256,CHANNEL_MASTER); 
   if(nRet !=SUCCESS)
      return nRet;
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL);
   if(nRet !=SUCCESS)
      return nRet;
   //free bitmap 
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);  
   return SUCCESS;
}
#endif // LEADTOOLS_V16_OR_LATER
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.