From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Overlay of text on 16-bit image

Solved!
Go to solution

I am trying to overlay text onto a 16-bit image.

The overlay is successfull (using IMAQ Overlay Text.vi), but I would like to save this file with the overlay.

 

I have been using IMAQ Write File 2.vi to write the image as a .png and it writes the image successfully, but not the overlay.

 

I have read this comment about overlays:

 

Using Overlay functions with a third-party viewer:
When using the IMAQ Overlay functions, a third-party viewer will not display this information. You must use the Read Image Vision Info with application software to view the overlay. To display an overlay in a third-party viewer, you can use the IMAQ Merge Overlay.vi, which is a destructive function, meaning that it replaces the underlying pixels with the overlaid pixels.

So basically I would like to view the images afterward on a third-party viewer, but when I use IMAQ Merge Overlay.vi, the result is no longer the 16-bit image I need.  It now becomes an RGB image.  Any suggestions on how to get a 16-bit image with overlayed text that I may view outside of LabVIEW?  Thanks.

0 Kudos
Message 1 of 14
(7,231 Views)

Hi jmeyer33,

There should be no problem doing this.  The merge overlay is going to turn the image into an RGB.  It mentions this in the help file for it but it would be easy to overlook.  What you can do is cast it back to a 16-bit image using IMAQ Cast Image.vi  Something like the attached image should work without any problems.

 

Message Edited by Adam_H on 11-21-2008 11:59 AM
Adam H
National Instruments
Applications Engineer
0 Kudos
Message 2 of 14
(7,210 Views)

Hi, Adam,

 

This will not work in that way - you will lost 16 bit information completely during merging and conversion to RGB:

 

 

What we can do is following:

- use copy overlay function for copying overlay to the other empty image (choose background color white for black overlay, or black for white overlay; same size as original)

- perform merge overlay with that copy. So, now overlay embedded as bitmap

- convert it back to 16 bit (remember, that gray range will be 0...255)

- join both images - original and overlay manually (some simple math opertions may required here). So now you have preserved original 16 bit image values (pixels with overlay destroyed, of course)

 

Andrey.

Message Edited by Andrey Dmitriev on 11-21-2008 08:00 PM
0 Kudos
Message 3 of 14
(7,202 Views)

Some things I don't understand about your diagram:

 -What is the IMAQ ArrayToImage.vi doing?  You don't mention that in your description.

-You mention the IMAQ Copy Overlay.vi (I assume that is what you meant by "use copy overlay function").  That is not in your diagram.

 

I'm somewhat new to LabVIEW, so thank you for your patience.

0 Kudos
Message 4 of 14
(7,193 Views)
Hi! The code above is not the solution for you problem yet. That was just illustration what happened if 16 bit converted to RGB. I have created two dimentional array with range 0...16383 (gradient), then converted it to image, then put text overlay on it and call Merge overlay. Then you see, that 16 bit gradient goes away... Andrey.
0 Kudos
Message 5 of 14
(7,188 Views)

Well, I will show full solution. There are many different ways how to do it. In assumtion that you have Black overlay you can do something like that:

 

 

 

Source code (LabVIEW 8.6) attached.

 

best regards,

Andrey.

Message Edited by Andrey Dmitriev on 11-21-2008 10:27 PM
Download All
Message 6 of 14
(7,175 Views)
Hi Andrey,

Thanks for pointing out an oversight on my part and thanks for the great post.

 
Adam H
National Instruments
Applications Engineer
0 Kudos
Message 7 of 14
(7,142 Views)

Thank you very much.  I am trying your suggestion to see if it applies.

LabVIEW newbie question: On the IMAQ FillImage.vi, how do I set the color for the fill in that U32 Color Pixel Value node?  Thanks for your patience.

0 Kudos
Message 8 of 14
(7,087 Views)
Solution
Accepted by topic author jmeyer33

Hi jmeyer,

I think this is what you mean.  Take a look at the screen shot.  When you create a constant or control on the input called Color Pixel Value it will create a dialog that will allow you to pick a color you would like to use when you click on the control/consatant.  If you want to input the actual U32 value you can replace this with a numeric constant/control and input the direct number you need.

Message Edited by Adam_H on 12-02-2008 10:17 AM
Adam H
National Instruments
Applications Engineer
Message 9 of 14
(7,058 Views)

Hi,

 

it seems that i have the same problem as you mentionned : the image all white with the only ROI profile on it...I tried to follow your instructions but i can't found the last VI that you use to SUPERIMPOSE the overlay AND the image !

 

ScreenShot049.jpg

 

If anyone can tell me what function is used that would be of great help!!

 

Thanks!

 

 

Message Edited by christophe69000 on 08-12-2009 07:54 AM
0 Kudos
Message 10 of 14
(6,774 Views)