USB 2.0 USB 3.x GigE |
USB 2.0 USB 3.x GigE |
Syntax
INT is_LUT(HIDS hCam, UINT nCommand, void* pParam, UINT cbSizeOfParams)
Description
Using is_LUT(), you can enable a hardware or software LUT for uEye cameras which will be applied to the image in the camera. Each lookup table (LUT) for the uEye camera contains modification values for the image brightness and contrast parameters. When a LUT is used, each brightness value in the image will be replaced by a value from the table. LUTs are typically used to enhance the image contrast or the gamma curve.
A number of predefined LUTs are available. Alternatively, you define your own LUT. A LUT consists of 32 sections. Each section is defined by start and end points. The values for the start and end points must be in the range between 0.0 and 1.0. If you want to create a linear LUT, the start and end points of successive sections must have the same values.
You can also define a LUT without enabling it at the same time. You can also query the current LUT used by the camera.
The nCommand input parameter is used to select the function mode. The pParam input parameter depends on the selected function mode. If you select functions for setting or returning a value, pParam contains a pointer to a variable of the UINT type. The size of the memory area to which pParam refers is specified in the cbSizeOfParam input parameter.
For further information on LUTs, please refer to the LUT properties section.
LUT and automatic exposure (AES)/gain control (AGC)
If you use LUT in combination with automatic exposure (AES) or gain control (AGC) undesired side effects may occur. For example, if you use a negative LUT (the image brightness is inverted) but at the same time the automatic control lightens the image. For this reason, disable the automatic controls if you use a discontinuous (jumps) or not completely positive (gradient) LUT.
Input parameters
hCam |
Camera handle |
pParam |
Pointer to a function parameter, whose function depends on nCommand. |
cbSizeOfParam |
Size (in bytes) of the memory area to which pParam refers. |
Contents of the IS_LUT_CONFIGURATION_PRESET_64 structure
IS_LUT_PRESET |
predefinedLutID |
ID of the predefined LUT |
IS_LUT_CONFIGURATION_64 |
lutConfiguration |
Predefined LUT |
Contents of the IS_LUT_CONFIGURATION_64 structure
DOUBLE |
dblValues[3][IS_LUT_64] |
Defines a LUT with 64 knee points. This results in 32 sections with a start and end point each. |
BOOL |
bAllChannelsAreEqual |
If TRUE, the same LUT is applied to all three channels. |
Contents of the IS_LUT_STATE structure
BOOL |
bLUTEnabled |
LUT is enabled |
INT |
nLUTStateID |
ID of the LUT status information |
INT |
nLUTModeID |
ID of the LUT mode |
INT |
nLUTBits |
Used bits of the LUT |
Contents of the IS_LUT_SUPPORT_INFO structure
BOOL |
bSupportLUTHardware |
Hardware LUT is supported |
BOOL |
bSupportLUTSoftware |
Software LUT is supported |
INT |
nBitsHardware |
Used bits of the hardware LUT |
INT |
nBitsSoftware |
Used bits of the software LUT |
INT |
nChannelsHardware |
Supported channels for hardware LUT |
INT |
nChannelsSoftware |
Supported channels for software LUT |
Return values
IS_FILE_READ_OPEN_ERROR |
The file cannot be opened. |
IS_FILE_WRITE_OPEN_ERROR |
File cannot be opened for writing or reading. |
IS_INVALID_PARAMETER |
One of the submitted parameters is outside the valid range or is not supported for this sensor or is not available in this mode. |
IS_NO_SUCCESS |
General error message |
IS_NOT_SUPPORTED |
The camera model used here does not support this function or setting. |
IS_SUCCESS |
Function executed successfully |
/* Enable the last set LUT */
IS_LUT_ENABLED_STATE nLutEnabled = IS_LUT_ENABLED;
INT nRet = is_LUT(hCam, IS_LUT_CMD_SET_ENABLED, (void*) &nLutEnabled, sizeof(nLutEnabled));
/* Force LUT and gamma to be included in software (former gamma behavior for cameras with USB3) */
IS_LUT_MODE nLutMode = IS_LUT_MODE_ID_FORCE_SOFTWARE;
INT nRet = is_LUT(hCam, IS_LUT_CMD_SET_MODE, &nLutMode , sizeof(nLutMode));
/* Readout the current LUT state */
IS_LUT_STATE lutState;
INT nRet = is_LUT(hCam, IS_LUT_CMD_GET_STATE, (void*) &lutState, sizeof(lutState));
/* Readout the current LUT support information */
IS_LUT_SUPPORT_INFO lutSupportInfo;
nRet = is_LUT(hCam, IS_LUT_CMD_GET_SUPPORT_INFO, (void*) &lutSupportInfo, sizeof(lutSupportInfo));
/* Set sigmoid function as user-defined LUT (scaled in x from [-6.0,6.0] to [0.0,1.0] */
/* Sigmoid function is S(x) = 1 / (1 + e^(-x)) */
//#include <cmath>
IS_LUT_CONFIGURATION_64 userLUT;
userLUT.bAllChannelsAreEqual = true;
userLUT.dblValues[0][0] = 0.0; /* Set start value to 0.0 */
for (INT i = 0; i <63; i += 2)
{
/* Start point of the next linear apporiximation segment is the end point of the previous segment. */
if (i> 0)
{
userLUT.dblValues[0][i] = userLUT.dblValues[0][i-1];
}
/* Calculate the value used in the scaled interval [0.0, 1.0] */
double dXPosWideRange = (((i + 1) / 64.0) - 0.5) * 12.0; /* Current position in the interval [0.0,1.0] stretched to [-6.0,6.0] */
userLUT.dblValues[0][i+1] = 1.0 / (1.0 + std::exp(-dXPosWideRange)); /* #include <cmath> is required */
}
userLUT.dblValues[0][63] = 1.0; /* Set end value to 1.0 */
/* Set the calculated LUT */
INT nRet = is_LUT(hCam, IS_LUT_CMD_SET_USER_LUT, (void*) &userLUT, sizeof(userLUT));
Fig. 201: Resulting LUT curve
/* Readout of the set LUT */
/* User-defined LUT (without included gamma) */
IS_LUT_CONFIGURATION_64 userLUT;
INT nRet = is_LUT(hCam, IS_LUT_CMD_GET_USER_LUT, (void*) &userLUT, sizeof(userLUT));
/* Complet LUT (with included gamma) */
IS_LUT_CONFIGURATION_64 completeLUT;
nRet = is_LUT(hCam, IS_LUT_CMD_GET_COMPLETE_LUT, (void*) &completeLUT, sizeof(completeLUT));
/* Set predefined LUT "Glow1" */
/* Firstly load GLOW1 */
IS_LUT_CONFIGURATION_PRESET_64 presetLUT;
presetLUT.predefinedLutID = IS_LUT_PRESET_ID_GLOW1;
INT nRet = is_LUT(hCam, IS_LUT_CMD_GET_PRESET_LUT, (void*) &presetLUT, sizeof(presetLUT));
/* Secondly set GLOW1 */
if (IS_SUCCESS == nRet)
{
nRet = is_LUT(hCam, IS_LUT_CMD_SET_USER_LUT, (void*) &presetLUT, sizeof(presetLUT));
}
/* Load the "lutFile.xml" file and set LUT */
wchar_t* pFilename = L"lutFile.xml";
INT nRet = is_LUT(hCam, IS_LUT_CMD_LOAD_FILE, (void*) pFilename , NULL);
/* Save the current set LUT into the "lutFile2.xml" file */
wchar_t* pFilename2 = L"lutFile2.xml";
nRet = is_LUT(hCam, IS_LUT_CMD_SAVE_FILE, (void*) pFilename2 , NULL);