LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to load an image and use the imaqOverlay function in 9.0.1. Can someone help me with the code?

I am trying to on a UIR bring in a picture upload an image of a schematic and use the imaqOverlay function on this. I have only had Basics I and do not understand how to do this and would appreciate any help that anyone could give me. I'm trying to highlight two pins when they are out of bounds.

 

 

0 Kudos
Message 1 of 4
(3,215 Views)

first you should be aware that the imaqOverlay*() functions are part of NI Vision, so you will need this library.

 

unfortunately, there is multiple ways to display an image onto an UIR, but the NI Vision package needs a "trick" to do that. can you tell us what the format of your picture is ? and what is the format of the overlay you want to add to your picture ? is it line drawings you will hand-code, or another picture file ?

 

CVI and the NI Vision library comes with a set of samples. most are accessible through the "Help/Find Examples" menu in CVI, or you may find them by hand (i am sorry, but vision examples are not showing up in my example finder, so i can't help you with the example finder). most NI Vision samples are using overlay to display the results, so you can get a lot of inspiration from those samples: use your favorite "find in files" tools and search for the text "imaqOverlay" in the NI Vision sample directory.

0 Kudos
Message 2 of 4
(3,212 Views)
I would be trying to overlay the Oval. Isn't that what the IMAQOverlayOval function does?
0 Kudos
Message 3 of 4
(3,208 Views)

indeed it is. the use of this function is straightforward:

 

imaqOverlayOval( image, imaqMakeRect( top, left, height, width ),  &IMAQ_RGB_RED, IMAQ_DRAW_VALUE, NULL );

 

beware of the parameter order for the imaqMakeRect() function. after drawing on the overlay, a call to imaqDisplayImage() should display the overlay. you can clear the overlay by calling imaqClearOverlay(). depending on the version of the vision library you are using, you may encounter problems when transforming the image: resizing, shifting, rotating clears the overlay on older versions of the library, but on newer versions the behavior is controlled by calling imaqSetOverlayProperties().

 

unfortunately, if you are using something else than the standard imaqDisplayImage() call to display your image, the overlay may not appear since it is stored on a separate layer of the image. in this case, you can try calling imaqMergeOverlay() but be carefull of making all transformation (shifting, rotating, resizing) of the image before merging the overlay or your drawing will become unreadable (line width will become so small that part of lines will not appear on the resulting image).

0 Kudos
Message 4 of 4
(3,177 Views)