National Instruments IMAQTM Digital Camera User Manual


 
Chapter 2 Getting Measurement-Ready Images
IMAQ Vision for Visual Basic User Manual 2-4 ni.com
Acquire or Read an Image
After you create an image, you can acquire an image into the imaging
system in one of the following three ways:
Acquire an image with a camera through the image acquisition device.
Load an image from a file stored on the computer.
Convert the data stored in a 2D array to an image.
Methods that acquire images, load images from file, or convert data
from a 2D array automatically allocate the memory space required to
accommodate the image data.
Acquiring an Image
Use the CWIMAQ control to acquire images with a National Instruments
IMAQ device. You can use IMAQ Vision for Visual Basic to perform
one-shot and continuous acquisitions. You can choose the acquisition type
during design time by setting the value of the Acquisition Type combo box
to One-Shot or Continuous. The Acquisition Type combo box is located
on the Acquisition property page of the CWIMAQ control. You can set the
value at run-time by setting the
CWIMAQ.AcquisitionType property to
cwimaqAcquisitionOneShot or cwimaqAcquisitionContinuous.
One-Shot Acquisition
Use a one-shot acquisition to start an acquisition, perform the acquisition,
and stop the acquisition using a single method. The number of frames
acquired is equal to the number of images in the images collection. Use the
CWIMAQ.AcquireImage method to perform this operation synchronously.
Use the
CWIMAQ.Start method to perform this operation asynchronously.
For information about synchronous and asynchronous acquisitions, refer to
the NI-IMAQ User Manual.
If you want to acquire a single field or frame into a buffer, set the image
count to 1. This operation is also referred to as a snap. Use a snap for
low-speed or single capture applications. The following code illustrates a
synchronous snap:
Private Sub Start_Click()
CWIMAQ1.AcquisitionType = cwimaqAcquisitionOneShot
CWIMAQ1.AcquireImage
End Sub