GetSequencePointer (DVR version only)
Top  Previous  Next

Description

Returns the pointer to the pixel at the specified coordinates of the selected frame in the memory sequence.


Syntax


[VB]
Value=objActiveUSB.GetSequencePointer( Frame, X, Y )


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


Data Types
[VB]

Frame: Long
X
: Integer
Y: Integer
Return value: Variant (pointer)


Parameters
[C/C++]

iFrame [in]  
The zero-based index of the frame in the memory sequence  
X [in]  
The x-coordinate of the pixel  
Y [in]  
The y-coordinate of the pixel  
pValue [out,retval]  
Pointer to the variant containing the pointer to the specified memory location  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  
E_INVALIDARG  
Invalid input arguments.  


Example


This C++ example grabs a frame, retrieves a pointer to the 32th line in the frame # 7 of the memory sequence and copies the pixels values into a byte array . A wrapper class CActiveUSB is used to access the ActiveUSB control:

BYTE line[4096];
int iWidth=m_ActiveUSB.GetSizeX;
int iHeight=m_ActiveUSB.GetSizeY;
VARIANT v=m_ActiveUSB.Get
Sequence
Pointer(
7,
0,
iHeight-1-32
);

memcpy(
&line
,v.pcVal,iWidth);

 

Remarks


The GetSequencePointer method provides the most efficient way to quickly access the memory sequence data in pointer-aware programming languages. The number of bytes in each line of the image buffer depends on the format and horizontal size of the video as specified in the following table:

Camera Pixel Format
Output Format
Line width in bytes

Mono8
8-bit monochrome
SizeX
Mono10, Mono12, Mono16
16-bit monochrome
SizeX * 2
YUV411, YUV422, YUV444, RGB8, BGR8, Bayer8
24-bit RGB
SizeX * 3
RGB10, RGB12, RGB16, BGR10, BGR12, Bayer10, Bayer12, Bayer16
48-bit RGB
SizeX * 6


Note that this method automatically converts the raw sequence data into standard monochrome or RGB output formats. To access the raw image data, use GetSequenceRawData.

Images in ActiveUSB are stored bottom up, therefore the zero vertical coordinate corresponds to the bottom line of the image.

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