ExtractImage Method
Syntax
CWIMAQ.ExtractImage ImageToExtract, ImageIndex
Return Type
This method returns 0 on success, a negative number on an error, and a positive number on a warning.
Purpose
Extracts an image from a live acquisition.
Remarks
Call this method to lock an image out of a continuous loop sequence for processing during a continuous, multibuffered acquisition. ImageIndex is the index of the image in the Images collection that you locked out of the acquisition. Call ReleaseImage to insert the image back into the acquisition.
Note Calling ExtractImage a second time automatically releases the first image.
Parameters
ImageToExtract As Variant
The cumulative image number of the image to extract.
ImageIndex As Variant
On return, the index of the image in the Images collection that you extracted.
Example
' This example requires you to have the following controls on the form: ' 1) A button named Acquire. ' 2) A button named Stop. ' 3) A button named Process. ' 4) A CWIMAQ control named CWIMAQ1 Private Sub Acquire_Click() CWIMAQ1.Start End Sub Private Sub Form_Load() 'Setup a ring acquisition CWIMAQ1.Images.Add (5) CWIMAQ1.AcquisitionType = cwimaqAcquisitionContinuous End Sub Private Sub Process_Click() Dim ImageToExtract Dim ImageIndex 'Extract an image ImageToExtract = CWIMAQ1.LastValidFrame + 5 CWIMAQ1.ExtractImage ImageToExtract, ImageIndex 'Do processing on extracted image CWIMAQ1.Images(ImageIndex) 'Release the extracted image CWIMAQ1.ReleaseImage End Sub Private Sub Stop_Click() CWIMAQ1.Stop End End Sub