11-20-2008 02:50 PM
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.
Solved! Go to Solution.
11-21-2008 11:57 AM - edited 11-21-2008 11:59 AM
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.
11-21-2008 12:57 PM - edited 11-21-2008 01:00 PM
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.
11-21-2008 01:53 PM
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.
11-21-2008 02:02 PM
11-21-2008 03:26 PM - edited 11-21-2008 03:27 PM
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.
11-24-2008 09:15 AM
Thanks for pointing out an oversight on my part and thanks for the great post.
12-01-2008 09:10 AM
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.
12-02-2008 10:16 AM - edited 12-02-2008 10:17 AM
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.
08-12-2009 07:53 AM - edited 08-12-2009 07:54 AM
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 !
If anyone can tell me what function is used that would be of great help!!
Thanks!