Home > C: Programming > Function descriptions > History back  Previous chapter  Next chapter  Print  

is_GetImageHistogram

uEye Camera Manual Version 4.00

is_GetImageHistogram

Windows_Logo

Linux_Logo

USB 2.0

USB 3.0

GigE

USB 2.0

USB 3.0

GigE

Syntax

INT is_GetImageHistogram (HIDS hCam,
                         int nID, INT ColorMode, DWORD* pHistoMem)

Description

is_GetImageHistogram() computes the histogram of the submitted image. The histogram always contains 256 values per channel. For color modes with a bit depth of more than 8 bits, the system evaluates the 8 most significant bits (MSBs).

Input parameters

hCam

Camera handle

nID

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

is_SetColorMode()

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);


Suggestion for improvement? Send us your short Feedback on this chapter. Thank you very much!

For technical questions please contact you local distributor or use the support form on our website.


© 2012 IDS Imaging Development Systems GmbH
http://www.ids-imaging.com