GetRawData
Top  Previous  Next

Description

Returns the two-dimensional array of values in the currently acquired data buffer or pointer to this buffer.


Syntax


[VB]
Value=objActiveGeni.GetRawData ([isPointer=False])


[C/C++]
HRESULT GetRawData(  bool isPointer, VARIANT* pArray );


Data Types
[VB]

Return value: Variant (SAFEARRAY)


Parameters
[C/C++]

isPointer [in]  
If false returns the array of raw data, otherwise returns pointer to data.  

pArray [out,retval]  
Pointer to the SAFEARRAY containing the raw data buffer.  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  


Example


This VB example grabs a frame, retrieves the raw data array and displays the value of the specified element of the array.

Dim
 pix 
as Long

ActiveGeni1.Grab
RawData=ActiveGeni1.GetRawData
x=16
y=32
pix=RawData(x,y)
if
 pix < 0 
then

pix=65535-pix
endif
MsgBox RawData(x,y)
 

Remarks


This function returns the frame data as they arrive from the camera (before being converted to a viewable format, such as RGB). GetRawData does not copy the image data, so the array returned contains the actual image buffer of the currently acquired frame. Modifying elements of the array will change actual pixel values in the image buffer. This can be used to perform custom image processing and display a processed image in real time. Note that this feature cannot be used in .NET as its framework creates a copy of the array returned. For direct access to raw data in C# set isPointer to True and use the poitner instead of an array.

Raw image data are stored in the standard order from top to bottom, therefore the first element of the array is first pixel of the top line of the image. The type of data and dimensions of the array returned by GetRawData depends on the current pixel format, horizontal width SizeX and the number of lines acquired, as specified in the following table:



Pixel Format
Data type
Dimensions

Mono8, Mono8Signed
Byte
0 to SizeX -1, 0 to Lines - 1
Bayer**8
Byte
0 to SizeX -1, 0 to Lines - 1
Mono10, Mono12, Mono16
Integer (word)
0 to SizeX -1, 0 to Lines - 1
Bayer**10, Bayer**12, Bayer**16
Integer (word)
0 to SizeX -1, 0 to Lines - 1
Mono10Packed, Mono12Packed
Byte
0 to SizeX*3/2 -1, 0 to Lines - 1
YUV411Packed
Byte
0 to SizeX*3/2 -1, 0 to Lines - 1
YUV422Packed, YUV444Packed
Integer (word)
0 to SizeX -1, 0 to Lines - 1
RGB8Packed, BGR8Packed
Byte
0 to SizeX * 3 - 1, 0 to Lines - 1
RGBA8Packed, BGRA8Packed
Byte
0 to SizeX * 4 - 1, 0 to Lines - 1
RGB10Packed, BGR10Packed, RGB12Packed, BGR12Packed
Integer (word)
0 to SizeX * 3 - 1, 0 to Lines - 1
BGR10V1Packed, BGR10V2Packed
Long
0 to SizeX -1, 0 to Lines - 1
RGB8Planar
Byte
0 to SizeX * 3 - 1, 0 to Lines - 1
RGB10Planar, RGB12Planar, RGB16Planar
Integer (word)
0 to SizeX * 3 - 1, 0 to Lines - 1


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 the example above).

Note that setting both Display and Magnification properties to zero will disable an image conversion pipeline that is normally applied to each raw frame. This will significantly increase the performance of your application as long as it does not utilize ActiveGeni's built-in image decoding/display.