Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I add a video overlay in VDM2009 C#?

Hello,

 

I am streaming data from a Firewire camera to an ImageViewer using this NI example:
C:\Documents and Settings\All Users\Documents\National Instruments\NI-IMAQdx\Examples\dotNET\Grab

 

For the life of me, I can't figure out how to draw a line on the live video feed and have it persist.

 

I know I can draw a line on the default overlay because when I click a button, the buttonhandler draws a line to the imageViewer1.Image.Overlays.Default object and I can see it flash on the screen and then disappear.  I'm assuming the next image in the imagestream is somehow overwriting the overlay. 

 

I tried copying the default overlay like so, but it didn't work:

// Grab the next image

uint bufNum;

Overlay curOverlay = imageViewer1.Image.Overlays.Default;

MainSession.Grab(imageViewer1.Image, true, out bufNum);

curOverlay.CopyTo(imageViewer1.Image);

 

Can anyone point me in the right direction?

 

Thanks,

Neville

0 Kudos
Message 1 of 3
(3,817 Views)

Overlays work on a per image basis.  Instead, you should use an ROI, which is linked to the display window.

 

There is probably some command that will set the ROI for the display window.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 2 of 3
(3,807 Views)

Hello Bruce,

 

Thanks for the tip.  I've got the line displaying on live video via an ROI.

 

How do I draw text on live video?  Do I use an ROI somehow or an overlay?

Thanks,
Neville 

0 Kudos
Message 3 of 3
(3,737 Views)