USB 2.0 USB 3.x GigE |
USB 2.0 USB 3.x GigE |
Syntax
INT is_HotPixel (HIDS hCam, UINT nCommand, void* pParam, UINT nSizeOfParam)
Description
is_HotPixel() configures the correction of sensor hot pixels. The correction is performed by the software. The hot pixel list is stored in the camera's non-volatile camera memory. Some sensor models can also correct hot pixels directly in the sensor. For further information on hot pixel correction, please refer to Basics: Hot pixels.
There are different hot pixel lists:
•*_SOFTWARE_USER_LIST: user-defined hot pixel list in the computer
•*_CAMERA_FACTORY_LIST: factory-set hot pixel list in the non-volatile camera memory
•*_CAMERA_USER_LIST: user-defined hot pixel list in the non-volatile camera memory
•*_MERGED_CAMERA_LIST: factory-set and user-defined hot pixel list in the non-volatile camera memory (*_CAMERA_FACTORY_LIST and *_CAMERA_USER_LIST)
This function is currently not supported by the following camera models: •UI-1007XS |
This correction will not work with subsampling or with binning factors greater than 2. |
Adaptive hot pixel correction
From version 4.82 on, the adaptive hot pixel correction is implemented additionally. The adaptive hot pixel correction can determine hot pixels dynamically and correct them adaptively in the current image. Thus, hot pixels can be corrected better which for example result from an increased temperature. In addition, the adaptive hot pixel correction can be executed directly in live operation, thus permitting the best possible optimization on the application conditions.
Note on adaptive hot pixel correction •Adaptive hot pixel correction can be used in combintaion with subsampling, binning or scaler. •Currently, adaptive hot pixel correction can only be used with software color formats or RAW color formats. |
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 nSizeOfParam input parameter.
Input parameters
hCam |
Camera handle |
pParam |
Pointer to a function parameter, whose function depends on nCommand. |
nSizeOfParam |
Size (in bytes) of the memory area to which pParam refers. |
Modes of the adaptive hot pixel correction
IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_ONCE |
The hot pixels are determined once and stored in a list. The adaptive hot pixel correction works with this list. This mode is suitable for all applications with static light conditions which do not require dynamic adaptation. |
IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_DYNAMIC |
The hot pixel list is dynamically determined for each image. So, this allows a better response for changing light conditions. In this mode, the full frame rate may not be achieved. |
IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_ONCE_CLUSTER |
In addition to the modes above, an adaptive cluster correction can be applied which also corrects two or more adjacent hot pixels. The hot pixel clusters are determined once and stored in the cluster list. The cluster list is independent from the hot pixel list. Note that the cluster detection could detect larger image content as a cluster. In this case, calibrate the camera against a low-contrast background or darken the camera before calibration. |
IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_DYNAMIC_CLUSTER |
The cluster list is dynamically determined for each image. So, this allows a better response for changing light conditions. In this mode, the full frame rate may not be achieved. |
The following combinations of the adaptive hot pixel and cluster correction are permitted:
•IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_ONCE
•IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_DYNAMIC
•IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_ONCE | IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_ONCE_CLUSTER
•IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_DYNAMIC | IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_ONCE_CLUSTER
•IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_DYNAMIC | IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_DYNAMIC_CLUSTER
Hint for adaptive hot pixel correction If the hot pixels are determined once, you should deactivate LUT, gamma, and RGB gains for detection. For dynamic detection, the use of LUT, gamma, and RGB gains may cause too many hot pixels to be determined and corrected. This can cause a high CPU load. |
Return values
IS_CANT_COMMUNICATE_WITH_DRIVER |
Communication with the driver failed because no driver has been loaded. |
IS_CANT_OPEN_DEVICE |
An attempt to initialize or select the camera failed (no camera connected or initialization error). |
IS_INVALID_CAMERA_TYPE |
The camera type defined in the .ini file does not match the current camera model. |
IS_INVALID_CAMERA_HANDLE |
Invalid camera handle |
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_IO_REQUEST_FAILED |
An IO request from the uEye driver failed. Possibly the versions of the ueye_api.dll (API) and the driver file (ueye_usb.sys or ueye_eth.sys) do not match. |
IS_NO_SUCCESS |
General error message |
IS_NOT_CALIBRATED |
The camera does not contain any calibration data. |
IS_NOT_SUPPORTED |
The camera model used here does not support this function or setting. |
IS_NULL_POINTER |
Invalid array |
IS_OUT_OF_MEMORY |
No memory could be allocated. |
IS_SUCCESS |
Function executed successfully |
IS_TIMED_OUT |
A timeout occurred. An image capturing process could not be terminated within the allowable period. |
// Enable/disable correction
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_DISABLE_CORRECTION, NULL, NULL);
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ENABLE_CAMERA_CORRECTION, NULL, NULL);
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ENABLE_SOFTWARE_USER_CORRECTION, NULL, NULL);
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ENABLE_SENSOR_CORRECTION, NULL, NULL);
nRet = is_HotPixel(hCam, IS_HOTPIXEL_DISABLE_SENSOR_CORRECTION, NULL, NULL);
// Read out current mode
INT nMode = 0;
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_GET_CORRECTION_MODE,
(void*)&nMode, sizeof(nMode));
// Query supported modes
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_GET_SUPPORTED_CORRECTION_MODES,
(void*)&nMode, sizeof(nMode));
// Query user-defined hot pixel list
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_GET_SOFTWARE_USER_LIST_EXISTS, NULL, NULL);
if (nRet == IS_SUCCESS)
{
// Query the number of hot pixels in the user-defined list
INT nNumber = 0;
nRet = is_HotPixel(hCam, IS_HOTPIXEL_GET_SOFTWARE_USER_LIST_NUMBER, (void*)&nNumber, sizeof(nNumber));
if (nRet == IS_SUCCESS)
{
// Allocate sufficient memory. Each hot pixel needs two WORDS
// memory space.
// Additional memory space of one WORD per hot pixel is required for numbering.
UINT nListSize = 1 + 2 * nNumber;
WORD *pList = new WORD[nListSize];
nRet = is_HotPixel(hCam, IS_HOTPIXEL_GET_SOFTWARE_USER_LIST, (void*)pList, nListSize * sizeof(WORD));
// Change a value and save the list.
// The number of the hot pixel has to be specified in pList[0]
pList[1] = 100;
nRet = is_HotPixel(hCam, IS_HOTPIXEL_SET_SOFTWARE_USER_LIST, (void*)pList, nListSize * sizeof(WORD));
// Delete unneeded list
delete [] pList;
}
}
// Save user-defined hot pixel list in computer to file
// The list is generated using IS_HOTPIXEL_SET_SOFTWARE_USER_LIST.
char File1[100];
ZeroMemory(File1, sizeof(File1));
strcpy(File1, "c:\\test.txt");
nRet = is_HotPixel(hCam, IS_HOTPIXEL_LOAD_SOFTWARE_USER_LIST, (void*)File1, 0);
nRet = is_HotPixel(hCam, IS_HOTPIXEL_SAVE_SOFTWARE_USER_LIST, (void*)File1, 0);
// Unicode
wchar_t File2[100];
ZeroMemory(File2, sizeof(File2));
wcscpy(File2, L"c:\\test.txt");
nRet = is_HotPixel(hCam, IS_HOTPIXEL_LOAD_SOFTWARE_USER_LIST_UNICODE, (void*)File2, 0);
nRet = is_HotPixel(hCam, IS_HOTPIXEL_SAVE_SOFTWARE_USER_LIST_UNICODE, (void*)File2, 0);
// Save user-defined list to the non-volatile camera memory
// Query the maximum number of hot pixels that can be saved in the non-volatile camera memory
INT nMaxNumber = 0;
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_GET_CAMERA_USER_LIST_MAX_NUMBER, (void*)&nMaxNumber, sizeof(nMaxNumber));
if (nRet == IS_SUCCESS)
{
// e. g. write 24 hotpixels into the camera memory
UINT nNumber = 24; // where nNumber <= nMaxNumber
// Allocate sufficient memory. Each hot pixel needed a two WORD memory.
// For the numbering, an additional memory of one WORD is required.
UINT nListSize = 1 + 2 * nNumber;
WORD *pList = new WORD[nListSize];
pList[0] = nNumber;
pList[1 + 2 * 0] = 10; // Hot pixel 1 - x value
pList[2 + 2 * 0] = 103; // Hot pixel 1 - y value
pList[1 + 2 * 1] = 100; // Hot pixel 2 - x value
pList[2 + 2 * 1] = 345; // Hot pixel 2 - y value
pList[1 + 2 * 2] = 123; // Hot pixel 3 - x value
pList[2 + 2 * 2] = 3; // Hot pixel 3 - y value
pList[1 + 2 * 3] = 235; // Hot pixel 4 - x value
pList[2 + 2 * 3] = 10; // Hot pixel 4 - y value
pList[1 + 2 * 4] = 355; // Hot pixel 5 - x value
pList[2 + 2 * 4] = 629; // Hot pixel 5 - y value
...
pList[1 + 2 * 23] = 1205; // Hot pixel 24 - x value
pList[2 + 2 * 23] = 553; // Hot pixel 24 - y value
nRet = is_HotPixel(hCam, IS_HOTPIXEL_SET_CAMERA_USER_LIST, (void*)pList, nListSize * sizeof(WORD));
delete [] pList;
}
// Delete user-defined hot pixel list
nRet = is_HotPixel(hCam, IS_HOTPIXEL_DELETE_CAMERA_USER_LIST, NULL, NULL);
// Return combined list
INT nNumber = 0;
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_GET_MERGED_CAMERA_LIST_NUMBER, (void*)&nNumber , sizeof(nNumber));
if (nRet == IS_SUCCESS)
{
// Allocate sufficient memory. Each hot pixel needs two WORDS
// memory space.
// Additional memory space of one WORD per hot pixel is required for numbering.
UINT nListSize = 1 + 2 * nNumber;
WORD *pList = new WORD[nListSize];
nRet = is_HotPixel(hCam, IS_HOTPIXEL_GET_MERGED_CAMERA_LIST, (void*)pList, nListSize * sizeof(WORD));
// Delete unneeded list
delete [] pList;
}
INT nEnable = 0;
// Returns the current state of the adaptive hot pixel correction
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_GET_ENABLE, (void*)&nEnable, sizeof(nEnable));
if (IS_SUCCESS == nRet)
{
if (IS_HOTPIXEL_ADAPTIVE_CORRECTION_DISABLE == nEnable)
{
// The adaptive hot pixel correction is disabled
}
else if (IS_HOTPIXEL_ADAPTIVE_CORRECTION_ENABLE == nEnable)
{
// The adaptive hot pixel correction is enabled
}
}
// Returns the default setting for the adaptive hot pixel correction
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_GET_ENABLE_DEFAULT, (void*)&nEnable, sizeof(nEnable));
if (IS_SUCCESS == nRet)
{
// Enabled the adaptive hot pixel correction
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_SET_ENABLE, (void*)&nEnable, sizeof(nEnable));
}
INT nMode = 0;
// Returns the current mode of the adaptive hot pixel correction
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_GET_MODE, (void*)&nMode, sizeof(nMode));
if (IS_SUCCESS == nRet)
{
if (IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_ONCE == nMode)
{
// The adaptive hot pixel correction is executed once
}
else if (IS_HOTPIXEL_ADAPTIVE_CORRECTION_DETECT_DYNAMIC == nMode)
{
// The adaptive hot pixel correction is executed dynamically
}
}
// Returns the default setting
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_GET_MODE_DEFAULT, (void*)&nMode, sizeof(nMode));
if (IS_SUCCESS == nRet)
{
// Sets a new mode for the adaptive hot pixel correction
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_SET_MODE, (void*)&nMode, sizeof(nMode));
}
INT nSensitivity = 0;
// Returns the current sensitivity value
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_GET_SENSITIVITY, (void*)&nSensitivity, sizeof(nSensitivity));
// Returns the default value for the sensitivity
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_GET_SENSITIVITY_DEFAULT, (void*)&nSensitivity, sizeof(nSensitivity));
// Returns the minimum value for sensitivity
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_GET_SENSITIVITY_MIN, (void*)&nSensitivity, sizeof(nSensitivity));
// Returns the maximum value for sensitivity
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_GET_SENSITIVITY_MAX, (void*)&nSensitivity, sizeof(nSensitivity));
if (IS_SUCCESS == nRet)
{
// Sets a new value for sensitivity
nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_SET_SENSITIVITY, (void*)&nSensitivity, sizeof(nSensitivity));
}
// Resets the list of the adaptive hot pixel correction
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_RESET_DETECTION, NULL, 0);
// Returns the number of corrected hot pixels in the last image
INT nNumber = 0;
INT nRet = is_HotPixel(hCam, IS_HOTPIXEL_ADAPTIVE_CORRECTION_GET_NUMBER_DETECTED, (void*)&nNumber, sizeof(nNumber));