LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving Overlay on 12Bit I16 image

Hi

I have a VB.net 2005 app with IMAQ and Vision Developement Module v8.5

I display a live video feed from a NI-1427 cameralink card. The video is 12bit grayscale, the buffer is I16 and every image gets an overlay.

I need to save a frame as a 12bit PNG file WITH the overlay. The overlay has to be permanent (distructive)!

If you use .WriteFileandVisionInfo the overlay is not imprinted on the frame.

Any suggestions will be appreciated.
0 Kudos
Message 1 of 6
(4,316 Views)
Hi Bestbier,

Overlays are designed specifically to be non-destructive so that they don't interfere with subsequent image processing alogrithms.  It sounds like you have NI Vision (as well as NI IMAQ) installed on your computer if you are able to place overlays on images.  I would use a draw instead of an overlay.  Draws are destructive to the image.  You can use your image processing to get the plotting information for specific overlay geometries, such as circles, and the feed that data into the inputs for the draw.  Most of the draw commands are methods of the CWIMAQVision function.  Information about this can be found by going to Start»Programs»National Instruments»Vision»Documentation»NI-Vision»cwimaq.chm.  This is the function reference for Vision.  Your code may look something like the following:


Dim i As New CWIMAQImage
Dim o As New CWIMAQOval

' Draw an oval on the image in Viewer1.
' Store the result in i.
o.Initialize 10, 20, 50, 100
CWIMAQVision1.DrawOval2 CWIMAQViewer1.Image, i, o, _
cwimaqDrawModeInvPaint


Wes P
Applications Engineer
National Instruments
Wes Pierce
Principal Engineer
Pierce Controls
0 Kudos
Message 2 of 6
(4,295 Views)
Hi

Thanks for that.

I got the .Drawline2 to work, but I need to write text aswell. The .Drawtext2 method only works on U8 and RGB32 images. My image in I16.

Any ideas?

Best regards
Bestbier

0 Kudos
Message 3 of 6
(4,286 Views)
have you considered using imaqMergeOverlay() ? after drawing all parts of your overlay, call this function to draw the non-destructive overlay on the image (thus making it a destructive overlay). it supports I16 images on input and outputs an RGB image.
0 Kudos
Message 4 of 6
(4,275 Views)
Hi

I have used the .Merge function. The problem is that I need to keep the frame in 12bit format.

I have used the following sequence of events, but am hoping the is a easier way of doing it. Please note that my images are grayscale and will always be gray, not pure black or pure white.

1. Load a black image into an u8 imagebuffer
2. Overlay everything I need onto this frame
3. Use .Merge to make the frame and the overlay one - Now I have a black image with white text and lines.
3. Use .Cast to change this u8 frame to I16
4. Use .Max to get the maximum form my video frame and the overlayed frame.

This does seem to work but is rather tedious.


0 Kudos
Message 5 of 6
(4,270 Views)
after posting my reply, i realized you may need to keep the 12bits resolution. the steps you are documenting are fine and was the next solution i would have proposed. you may also replace the Max operation by an XOR so that overlayed pixels are always inverted with respect to the underlying image pixels.

the process seems tedious, but such contorsions are rather common in vision...

if you are not affraid of direct pixel manippulations (by using imageStart and pixelsPerLine returned by GetImageInfo(), although i don't know if it works in VB), you can make cast and max in a single operation.
0 Kudos
Message 6 of 6
(4,257 Views)