SetImageWindow
Top  Previous  Next

Description

Copies pixel values from the two-dimensional array into the selected window of the current frame.


Syntax


[VB]
objActiveDcam.SetImageWindow X, Y, A


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


Data Types
[VB]

X,Y: Integer
A
: Variant (SAFEARRAY)


Parameters
[C/C++]
 
X [in], Y[in]  
The x- and y- frame coordinates at which the top left corner of the window will be copied.  
pArray [out,retval]  
Pointer to the SAFEARRAY containing the pixel values to be copied.  


Return Values


S_OK  
Success  
E_FAIL  
Failure  
E_INVALIDARG  
Input array has wrong data type  


Example


This VB example uses the FrameAcquired event to increase the brightness in the central area of the live image:

Private Sub
 Form_Load()

ActiveDcam1.Display = 
False

ActiveDcam1.Acquire = 
True

End Sub

 
Private Sub
 ActiveDcam1_FrameAcquired()

xc = ActiveDcam1.SizeX / 2
yc = ActiveDcam1.SizeY / 2
w = ActiveDcam1.GetImageWindow(xc - 70, yc - 50, 140, 100)

For
 y = 0 To UBound(w, 2)
For
 x = 0 To UBound(w, 1)
pix = w(x, y) + 50

If
 pix > 255 Then
pix = 255

End If

w(x, y) = pix

Next
Next

ActiveDcam1.SetImageWindow xc - 70, yc - 50, w
ActiveDcam1.Draw

End Sub

 

Remarks


The array submitted to SetImageWindow must have the type and dimensions corresponding of those of the frame buffer, as specified in the following table:

Format
Data type
Horizontal Dimension

8-bit monochrome
Byte
Width
16-bit gray monochrome
Integer (word)
Width
24-bit RGB
Byte
Width*3
48-bit RGB
Integer (word)
Width*3


where Width is the intended horizontal size of the window in in pixels. If the dimensions of the window are too large to accomodate the frame size, they will be clipped to the frame boundaries.

For real-time image processing SetImageWindow should be used in conjunction with the Draw method.