LBitmap::CountLUTColors

Summary

Gets the total number of entries between the start color and the end color, and the index of the last occurrence of the start color. The start and end colors are determined internally.

Syntax

#include "ltwrappr.h"

static L_INT LBitmap::CountLUTColors(pLUT, ulLLUTLen, pNumberOfEntries, pFirstIndex, uFlags)

Parameters

RGBQUAD * pLUT

Pointer to a lookup table.

L_UINT32 ulLLUTLen

LUT length.

L_UINT * pNumberOfEntries

Pointer to a variable to be updated with total number of entries in start to end color.

L_INT * pFirstIndex

Pointer to a variable to be updated with index of the last occurrence of the start color.

L_UINT uFlags

Flag that indicates whether the LUT belongs to a signed or unsigned image. Possible values are:

Value Meaning
COUNT_LUT_UNSIGNED [0x0001] LUT belongs to a signed image.
COUNT_LUT_SIGNED [0x0002] LUT belongs to an unsigned image.

Returns

Value Meaning
SUCCESS LUT is Linear (success).
0 LUT is not linear (fail).
<0 An error occurred. Refer to Return Codes.

Comments

Suppose you have a LUT with 4096 colors, the first 200 colors are black and the last 30 are white: the rest of the colors between black and white are gray. This is what the function will provide:

PNumberOfEntries: 3868.

pFirstIndex: 199.

In more detail this is:

Total number of entries: 4096 (0 - 4095)

First index of the end color: 4095 - 30 + 1 (+1 to add the first index of the end color to the range)

Number of occurrences of the starting color: 200 (0 - 199)

The last index of the start color: 199

Total number of entries: (4095 - 30 + 1) - 199 + 1

This function supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

This function supports signed data images.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

get bitmap pLUT total number of entries in start to end colors and the index of the last occurrence of the start color.

L_INT LBitmap__CountLUTColorsExample(LBitmap * pBitmap, L_UINT * pNumberOfEntries, L_INT *pFirstIndex)  
{ 
    
   return LBitmap::CountLUTColors (pBitmap->GetHandle()->pLUT, pBitmap->GetHandle()->LUTLength,  
                                   pNumberOfEntries,pFirstIndex,  
                                   pBitmap->GetHandle()->Flags.Signed? COUNT_LUT_SIGNED:COUNT_LUT_UNSIGNED );  
 
} 

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.