GetImagePointer
Top  Previous  Next

Description

This COM method returns the pointer to the pixel at the specified coordinates of an image.


Syntax


[VB]
Value=objImageWarp.GetImagePointer( Inp, X, Y )


[C/C++]
HRESULT GetImagePointer( int Inp, int X, int Y, VARIANT* pValue );


Parameters
[C/C++]

X [in]  
The x-coordinate of the pixel  
Y [in]  
The y-coordinate of the pixel  
pValue [out,retval]  
Pointer to the specified memory location  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  


Example


This C++ example grabs a frame, retrieves a pointer to the 32th line in the frame memory and copies the pixels values into a byte array . A wrapper class CImageWarp is used to access the COM object :

BYTE line[4096];
int iWidth=m_ImageWarp.GetSizeX;
m_ImageWarp.Call("grabim(1))
While IW.Status <> SS_IDLE
Wend
BYTE* ptr=m_ImageWarp.GetImagePointer(1,0,32);
memcpy(
&line
,v.pcVal,iWidth);

 

Remarks


The GetImagePointer method provides the most efficient way to quickly access the content of ImageWarp images in pointer-aware programming languages. Unlike GetImageArray, this method doesn't modify original pixel values of high-bit depth images. 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:




Format
Line width in bytes

8-bit monochrome
SizeX
16-bit gray monochrome
SizeX * 2
32-bit gray monochrome
SizeX * 4
float
SizeX * 4
complex
SizeX * 8
24-bit RGB
SizeX * 3
32-bit RGB
SizeX * 4
48-bit RGB
SizeX * 6