GetPicture
Top  Previous  Next

Description

Returns a Picture object created from the currently acquired frame.


Syntax


[VB]
Value=objActiveUSB.GetPicture()


[C/C++]
HRESULT GetPicture(IPictureDisp* *pPicture);


Data Types
[VB]

Return value: Picture


Parameters
[C/C++]

pPicture [out,retval]  
Pointer to the IPictureDisp interface object  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  

Example



This VB example uses the FrameAcquired event to display a live video in a PictureBox:

 
Private Sub
 ActiveUSB1_FrameAcquired(ByVal Lines As Integer)

  Picture1.Picture=ActiveUSB1.GetPicture
End Sub

This VB.NET example shows how to display a live video in a PictureBox:

Private Sub
 AxActiveUSB1_FrameAcquired(
ByVal
 sender 
As System.Object, ByVal e As System.EventArgs) Handles AxActiveUSB1.FrameAcquired
 If Not (PictureBox1.Image Is Nothing) Then PictureBox1.Image.Dispose()
 
 PictureBox1.Image = Bitmap.FromHbitmap(AxActiveUSB1.GetPicture.Handle)
End Sub

This C# statement shows how to display an image in a PictureBox:

 
pictureBox1.Image = Bitmap.FromHbitmap((System.IntPtr)axActiveUSB1.GetPicture().Handle);


Remarks


The GetPicture method provides the most convenient graphic interface to ActiveUSB internal image and allows you to display the last acquired frame in popular graphic controls such as PictureBox. Note that a Picture object contains only 8-bit pixel values, even if the current video mode is a 16- or 48-bit one. To access the actual pixel data, use the GetImageData or GetPointer methods.

In .NET programming environment calling GetPicture inside the FrameAcquiredX event handler may not work. Use the FrameAcquired event instead. It is also necessary to apply the Dispose() method to the PictureBox Image property before each subsequent call to GetPicture in order to prevent the memory leak.