USB 2.0 USB 3.x GigE |
USB 2.0 USB 3.x GigE |
Syntax
INT is_GetImageHistogram (HIDS hCam, INT nMemId, INT ColorMode, DWORD* pHistoMem)
Description
is_GetImageHistogram() computes the histogram of the submitted image. The is_GetImageHistogram() function supports the following color formats:
•IS_CM_SENSOR_RAW8
•IS_CM_MONO8
•IS_CM_RGBY8_PACKED
•IS_CM_BGRY8_PACKED
•IS_CM_RGBA8_PACKED
•IS_CM_BGRA8_PACKED
•IS_CM_BGR565_PACKED
•IS_CM_BGR5_PACKED
•IS_CM_RGB8_PACKED
•IS_CM_BGR8_PACKED
•IS_CM_MONO10
•IS_CM_MONO12
•IS_CM_MONO16
•IS_CM_RGB10_PACKED
•IS_CM_BGR10_PACKED
•IS_CM_RGB10_UNPACKED
•IS_CM_BGR10_UNPACKED
•IS_CM_RGB12_UNPACKED
•IS_CM_BGR12_UNPACKED
Histogram for USB uEye XS Make sure that the image memory for the USB uEye XS is allocated with the right size so that the histogram can be calculated correctly. |
Input parameters
hCam |
Camera handle |
nMemId |
Memory ID |
ColorMode |
Color mode of the image with the nID memory ID For a list of all available color formats and the associated input parameters, see the Appendix: Color and memory formats section. |
pHistoMem |
Pointer to a DWORD array The array must be allocated in such a way that it can accommodate 3*256 values for color formats and in raw Bayer mode. In monochrome mode, the array must be able to accommodate 1*256 values. |
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_COLOR_FORMAT |
Invalid color format |
IS_INVALID_CAMERA_HANDLE |
Invalid camera handle |
IS_INVALID_MEMORY_POINTER |
Invalid pointer or invalid memory ID |
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_NULL_POINTER |
Invalid array |
IS_SUCCESS |
Function executed successfully |
Related functions
Example
char * pcSource;
INT nIDSource;
is_AllocImageMem (hCam, 256, 256, 24, &pcSource, &nIDSource);
int nX, nY, nBits, nPitch;
is_InquireImageMem (hCam, pcSource, nIDSource, &nX ,&nY, &nBits, &nPitch);
//Create RGB test image
for (int j = 0; j < nY; j++)
{
for (int i = 0; i < nX*3; i += 3)
{
pcSource[i + j*nPitch] = 0; // Blue pixels
pcSource[i + j*nPitch + 1] = i/3; // Green pixels
pcSource[i + j*nPitch + 2] = 255; // Red pixels
}
}
// Create memory for RGB histogram
DWORD bgrBuffer [256*3];
//Create pointer for each histogram color
DWORD * pBlueHisto = bgrBuffer;
DWORD *pGreenHisto = bgrBuffer + 256;
DWORD * pRedHisto = bgrBuffer + 512;
//Retrieve histogram and release memory
is_GetImageHistogram (hCam, nIDSource, IS_CM_RGB8_PACKED, bgrBuffer);
is_FreeImageMem (hCam, pcSource, nIDSource);