GetPixel
Top  Previous  Next

Description

Returns the pixel value at the specified coordinates.


Syntax


[VB]
Value=objActiveGeni.GetPixel( X, Y )


[C/C++]
HRESULT GetPixel( short X, short Y, long* pValue );


Data Types
[VB]

X: Integer
Y: Integer
Return value: Long


Parameters
[C/C++]

X [in]  
The x-coordinate of the pixel  
Y [in]  
The y-coordinate of the pixel  
pValue [out,retval]  
Pointer to the pixel's value  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  
E_INVALIDARG  
Invalid input arguments.  


Example


This VB example grabs a frame and displays the value of the pixel at the specified coordinates.

ActiveGeni1.Grab
value=ActiveGeni1.GetPixel(64,32)
MsgBox value
 

Remarks


The value returned by GetPixel depends on the format of the video acquired. For monochrome video the method will retrieve the data from the internal image memory. For the color video the RGB data in the specified coordinates will be converted to the luminance using the formula: L=(R+G+B) / 3.

The values of the x and y coordinates must not exceed the width and height of the video frame, or the error will occur.