GetImageStat
Top  Previous  Next

Description

Returns the array containing statistical data of the current image frame over a selected ROI.


Syntax


[VB]
Value=objActiveUSB.GetImageStat( Component [,Step] )


[C/C++]
HRESULT GetImageStat( VARIANT* pStat, short Component, short Step=1 );


Data Types
[VB]

Channel : Integer
Bins : Long
Step
: Integer
Return value: Variant (Array of Single values)


Parameters
[C/C++]

Component [in]  
Enumerated integer specifying the color component for which the image statistics is obtained. This parameter is disregarded for grayscale images. Must be one of the following values:  
0 - collects the statistics of the luminance of the image  
1 - collects the statistics of the red component of the image  
2 - collects the statistics of the green component of the image  
3 - collects the statistics of the blue component of the image  
 
Step [in]  
An optional integer between 1 and 16 specifying the sampling step, which is used to collect pixel values for the calculations. If this number is 1, every pixel is taking into consideration. If the number is 2, every second pixel in a row will be skipped, as well as every second row in the image, etc. Increasing the sampling step raises the speed of the image statistics collection, but sacrifices some accuracy.  
 
pStat [out,retval]  
Pointer to the SAFEARRAY (float) containing the image statistics. The statistics is written to the array as follows:  
Stat [0] – Mean value  
Stat [1] – Standard deviation  
Stat [2] – Pixel count  
Stat [3] – Minimum  
Stat [4] – Maximum  
Stat [5] – Median  
Stat [6] – Skewness  
Stat [7] – Kurtosis  
 
 
Return Values

S_OK  
Success  
E_FAIL  
Failure.  


Example


This VB example displays the mean value and standard deviation of the red component per each frame acquired:

Private Sub
 ActiveUSB1_FrameAcquired()

ActiveUSB1.SetROI 100,100,500, 400 

StatArray=ActiveUSB1.GetImageStat 1
LabelMean.Caption=StatArray[0]
LabelStd.Caption=StatArray[1]
End Sub

 

Remarks


The image statistics is calculated over the rectangular region of interest and luminance range defined by SetROI. If the ROI is not set, the whole size and luminance range of the image will be used.