GetComponentLine
Top  Previous  Next

Description

Returns the array of pixel values of the specified color component at the specified horizontal line of the current frame.


Syntax


[VB]
Value=objActiveGeni.GetComponentLine( Y, Component )


[C/C++]
HRESULT GetComponentLine( short Y, short Component, VARIANT* pArray );


Data Types
[VB]

Y: Integer
Component: Integer
Return value: Variant (SAFEARRAY)


Parameters
[C/C++]

Y [in]  
The y-coordinate of the line in the image  
Component [in]  
The index of the selected color component. Must be one of the following values:  
0 - returns the luminance data  
1 - returns the red component data  
2 - returns the green component data  
3 - returns the blue component data  
pArray [out,retval]  
Pointer to the SAFEARRAY containing the pixel values in the line  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  
E_INVALIDARG  
Invalid input argument.  


Example


This VB example grabs a frame, retrieves the 32th row of green pixels and displays the value of 10th pixel in the row.

ActiveGeni1.Grab
Line=ActiveGeni1.GetComponentLine(32,2)
MsgBox Line(10)
 

Remarks


The array returned by GetComponentLine has the dimension range from 0 to SizeX - 1. The type of data in the array depends on the format of the video acquired. For the 24-bit video the method will return an array of bytes. If the video is of the high-bit depth, the array will contain integer (word) values. If the video has a grayscale format, the Component parameter will have no effect and the output array will contain the luminance data (see GetLine).

Note that modifying elements of the array will not change actual pixel values in the frame buffer.

The value of the y coordinate must not exceed the height of the video frame, or the error will occur.

Note that in C/C++ applications it is required to call SafeArrayDestroy() to delete the SAFEARRAY returned by GetComponentLine.