IMVHistogram

The IMVHistogram interface offers several methods to calculate a histogram of an image, on a selected pin of a MontiVision image processing filter. Please read the remarks for implementation details.

get_SelectedHistPin Returns the currently selected histogram pin.
put_SelectedHistPin Sets the desired histogram pin.
get_HistPinDirection Returns the current histogram pin direction.
put_HistPinDirection Sets the desired histogram pin direction.
get_HistChannel Returns the selected color channel.
put_HistChannel Sets the selected color channel.
get_WhiteClipping Returns the clipping status.
put_WhiteClipping Sets white clipping status.
get_BlackClipping Returns the clipping status.
put_BlackClipping Sets the clipping status.
get_WhiteClipWidth Returns the white clip width.
put_WhiteClipWidth Sets the white clip width.
get_BlackClipWidth Returns the black clip width.
put_BlackClipWidth Sets the black clip width.
CalculateHistogram Starts the histogram calculation on the next processed image.
GetHistogramData Returns the last calculated histogram.
GetNumOfPinChannel Returns the number of color channels for the currently selected pin.

Header file: iMVHistogram.h
Interface definition language file: iMVHistogram.idl
Interface ID:
IID_IMVHistogram

HRESULT get_SelectedHistPin( [out, retval] int *piActualPin );

Returns the currently selected histogram pin.

Parameter:

piActualPin A pointer to an integer value that receives the number of the current histogram pin.

 

HRESULT put_SelectedHistPin( [in ] int iActualPin );

Sets the selected histogram pin.

Parameter:

iActualPin The selected histogram pin.

 

HRESULT get_HistPinDirection( [out, retval] int *piPinDirection );

Returns the direction of the histogram pin.

Value Description
0 Output pin.
1 Input Pin

Parameter:

piPinDirection A pointer to an integer value that receives the direction of the histogram pin.

 

HRESULT put_HistPinDirection( [in ] int iPinDirection );

Sets the direction of the histogram pin.

Value Description
0 Output pin.
1 Input Pin

Parameter:

iPinDirection The direction of the histogram pin.

 

HRESULT get_HistChannel( [out, retval] int *piChannel );

Returns the currently selected color channel.

Parameter:

piChannel A pointer to an integer value that receives the selected color channel as MV_COLOR_CHANNEL.

 

HRESULT put_HistChannel( [in ] int iChannel );

Sets the desired color channel.

Parameter:

iChannel The desired color channel as MV_COLOR_CHANNEL.

 

HRESULT get_WhiteClipping( [out, retval] int *piWhiteClip );

Returns clipping information of the histogram.. If TRUE (1) is returned, then white clipping is enabled and the the values at the end of the histogram array are set to zero. Use get_WhiteClipWidth to get extended information about the number of array values that are set to zero. If the clip width is set to 5, all values from 251 to 255 are set to zero.

Parameter:

piWhiteClip A pointer to an integer value that receives the clipping information.

 

HRESULT put_WhiteClipping( [in ] int iWhiteClip );

Activates or deactivates white clipping on the histogram. TRUE (1) enables and FALSE (0) disables the white clipping function. Use put_WhiteClipWidth to set the desired clip width. If the clip width is set to 5, all values from 251 to 255 are set to zero.

Parameter:

iWhiteClip The desired white clipping mode.

 

HRESULT get_BlackClipping( [out, retval] int *piBlackClip );

Returns clipping information of the histogram. If TRUE (1) is returned, black clipping is enabled and the the values at the beginning of the histogram array are set to zero. Use get_BlackClipWidth to get information about the number of array values that are set to zero. If the clip with is set to 5, all values from 0 to 4 are set to zero.

Parameter:

piBlackClip A pointer to an integer value that receives the clipping information.

 

HRESULT put_BlackClipping( [in ] int iBlackClip );

Activates or deactivates black clipping on the histogram. TRUE (1) enables and FALSE (0) disables the black clipping function. Use put_BlackClipWidth  to set the desired clip width. If the clip width is set to 5, all values from 0 to 4 are set to zero.

Parameter:

iBlackClip The desired black clipping mode.

 

HRESULT get_WhiteClipWidth ( [out, retval] int *piWhiteClip );

If the clip width is set to 5, all values from 251 to 255 are set to zero. Use get_WhiteClipping to see if white clipping is enabled.

Parameter:

piWhiteClip A pointer to an integer value that receives the clip width.

 

HRESULT put_WhiteClipWidth( [in ] int iWhiteClip );

If the clip width is set to 5, all values from 251 to 255 are set to zero. Use put_WhiteClipping to enable white clipping.

Parameter:

iWhiteClip The desired white clip width.

 

HRESULT get_BlackClipWidth( [out, retval] int *piBlackClip );

If the clip width is set to 5, all values from 0 to 4 are set to zero. Use get_BlackClipping to see if black clipping is enabled.

Parameter:

piBlackClip A pointer to an integer value that receives the clip width.

 

HRESULT put_BlackClipWidth( [in ] int iWhiteClip );

If the clip width is set to 5, all values from 0 to 4 are set to zero. Use put_BlackClipping to enable black clipping.

Parameter:

iBlackClip The desired white clip width.

 

HRESULT CalculateHistogram();

Activates the histogram calculation for the next processed image.

 

HRESULT GetHistogramData( [out] int iHistogram[256] );

Returns the histogram of the selected color channel of the chosen pin. If the color channel is set to zero and the image has three or more channels, the sum of all channels is returned.

Parameter:

iHistogram An array of 256 integers that represent the histogram of an image.

 

HRESULT CalculateHistogram();

Activates the histogram calculation on the next processed image.

 

HRESULT GetNumOfPinChannel( [out, retval] int *piNumOfChannel );

Returns the number of color channels for the currently selected pin.

Parameter:

piNumOfChannel Pointer to an integer that receives the number of color channels.

 

 

Remarks

The following code is an example, in this case showing how to receive the histogram of an image.

int iNumOfInPins;
IMVFilterInfo *pIMVFilterInfo;
IMVHistogram  *pIMVHistogram;

pIMVFilterInfo->get_NumOfInPins( &iInputPins );
if( iNumOfInPins > 0 )
{
   pIMVHistogram->put_HistPinDirection( 1 ); // input pin
   pIMVHistogram->put_HistPin( 0 );                     // pin number 0, the first pin

   pIMVHistogram->put_HistChannel( MV_CHANNEL_ALL )     // all channels
   pIMVHistogram->put_WhiteClipping( TRUE );            // enable white clipping
   pIMVHistogram->put_WhiteClipWidth( 1 );              // clip only the value 255
   pIMVHistogram->put_BlackClipping( TRUE );            // enable black clipping
   pIMVHistogram->put_BlackClipWidth( 1 );              // clip only the value 0
   pIMVHistogram->CalculateHistogram();                 // Calculate the histogram on the next image
}

...

// Act on timer or filters end calculation COM Event
int iHistogramm[256];
HRESULT hr = pIMVHistogram->GetHistogrammData( &iHistogramm );
if( hr != S_OK )
{
    // Do some error processing ...
}