GetImageLine
Top  Previous  Next

Description

Returns the array of pixel values at the specified horizontal line of the currently acquired frame.


Syntax


[VB]
Value=objActiveUSB.GetImageLine( Y )


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


Data Types
[VB]

Y: Integer
Return value: Variant (SAFEARRAY)


Parameters
[C/C++]

Y [in]  
The y-coordinate of the line in the image  
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 33th row of pixels and displays the value of 11th pixel in the row.

Dim
 pix 
as Long

ActiveUSB1.Grab
Line=ActiveUSB1.GetImageLine(32)
pix=Line(10)
if
 pix < 0 
then

pix=65535-pix
endif

MsgBox Line(10)
 

Remarks


The array returned by GetImageLine is a copy of the actual raw of pixels. Modifying elements of the array will not change actual pixel values in the frame buffer. The type of data and dimension of the array returned by GetImageLine depends on the output format of the video as specified in the following table:

Camera Pixel Format
Output Format
Data type
Dimension

Mono8
8-bit monochrome
Byte
0 to SizeX -1
Mono10, Mono12, Mono16
16-bit gray monochrome
Integer (word)
0 to SizeX -1
YUV411, YUV422, YUV444, RGB8, BGR8, Bayer8
24-bit RGB
Byte
0 to SizeX * 3 - 1
RGB10, RGB12, RGB16, BGR10, BGR12, Bayer10, Bayer12, Bayer16
48-bit RGB
Integer (word)
0 to SizeX * 3 - 1


The value of the y coordinate must not exceed the height of the video frame, or the error will occur. For integer (word) type of data you can receive negative numbers if pixel values exceed 32767. In C and C# you can convert signed integers to unsigned ones by using data casting. To get rid of negative values in VB and Delphi, subtract them from 65535 (see example above).

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