Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to draw region on Continuous Acquistion mode?

When I am in continuous Acquisition mode (grab) in my Visual Basic Application, I would like my program to be able to draw a point or just something on the viewer as a reference point. I use this following code in my VB program:
cwimaqviewer1.image.Overlays(1).DrawRegion
However, I keep getting a run time error about the Aquisition being lock by another process.

Please advice. Thanks.

--Simon
0 Kudos
Message 1 of 2
(3,018 Views)
Simon,

When you attach an acquision buffer to the viewer, then you cannot make any changes to the image (eg. overlays), because the acquisition process has the buffer locked or protected.

If you want to make changes to the live display of an acquisition, simply make a copy of the acquisition buffer to a user defined buffer and attach the copy to the viewer as shown below. We can now add overlays to the image without affecting the acquisition process. This is just one example of the low level acquisition control that the NI-IMAQ allows.

For flicker-free updates of the overlays, be sure to set "immediate updates" to false in the in the viewer properties.

Dim myImage As New CWIMAQImage

CWIMAQVision1.Copy CWIMAQ1.Images(ImageIndex), myImage

CWIMAQViewer1.I
mage.Overlays(1).DrawText Origin, Options, Text

CWIMAQViewer1.Attach myImage

Regards,

Brent R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,015 Views)