GetRGBPixel
Top  Previous  Next

Description

Returns the array of RGB values at the specified coordinates.


Syntax


[VB]
Value=objActiveDcam.GetRGBPixel( X, Y )


[C/C++]
HRESULT GetRGBPixel( short X, short Y, VARIANT* pArray );


Data Types
[VB]

X, Y: Integer
Return value: Variant (SAFEARRAY)


Parameters
[C/C++]

X [in]  
The x-coordinate of the pixel  
Y [in]  
The y-coordinate of the pixel  
pArray [out,retval]  
Pointer to the SAFEARRAY of the dimension of 3 containing long R, G and B values of the current pixel  


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 G-value of the pixel at the specified coordinates.

ActiveDcam1.Grab
RGB=ActiveDcam1.GetRGBPixel(64,32)
MsgBox RGB(1)
 

Remarks


The values returned by GetRGBPixel depend on the format of the video acquired. For 24-bit video the method will retrieve the data from the internal image memory. For the grayscale video the R, G, and B values will be the same and equal to the luminance value in the specified coordinates.

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