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

is_GetImageHistogram

uEye Camera Manual Version 3.80

is_GetImageHistogram

Windows_Logo

Linux_Logo

USB 2.0

GigE

USB 2.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_SUCCESS

Function executed successfully

IS_NO_SUCCESS

General error message

IS_NULL_POINTER

Invalid Array

IS_INVALID_COLOR_FORMAT

Unsupported color format

IS_INVALID_PARAMETER

Unknown ColorModeparameter

Related Functions

is_SetColorMode()

Code Sample


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!


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