LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Image Overlay not working when saving image to folder

Solved!
Go to solution

Hello 

I am trying to overlay text onto an image(tiff files), merge that overlay, and then cast it back to its original 16 bit form. Then, stitch that image with another 16 bit image. Everything works except the merge overlay function doesn't seem to be working, when I save the image to a folder on my computer and open it up it no longer has text. I tried passing the Merge Overlay function a RQB (U32) IMAQ temporary image in the Image Dist parameter as suggested in another discussion but no luck. I have attached my VI file. Any help is appreciated! 

Thanks

Download All
0 Kudos
Message 1 of 25
(4,987 Views)

Update: Looks like the Merge overlay is working up until I cast the RGB image to a 16 bit grayscale image. I need to cast the overlayed image in order to stitch the two images together. any suggestions?

 

0 Kudos
Message 2 of 25
(4,983 Views)

I'm not sure why this would cause this behavior, but running your test code I was able to get the overlayed image to save correctly by removing the for loop around the filename creation code:

 

BD.png

 

I also found that removing the IMAQ Fill Image VI also allowed the overlayed image to save. This is really strange behavior though. I wouldn't think that having a for loop in there that doesn't interface with the image at all would make any difference, especially because the filepath being created is the same either way. 

 

-Jordan

0 Kudos
Message 3 of 25
(4,930 Views)

I have observed similar strange behavior. Now the text disappears after I implement the Image cast function and try to save the image to my computer. Is the overlayed text being lost when casting the 32 bit RGB to 16 grayscale? I thought the data would be conserved. The ultimate goal is to have the overlayed text be saved in the stitched together image at the end of the VI. In addition, I tried to adapt the VI posted in this discussion to work with the image I am trying to overlay text over and stitch with another image, but I haven't been able to get it to work. Maybe, someone that understands what he does in his VI could explain to me or help me adapt it to fit my needs. Thanks! also attached my most current VI for trying to overlay the text and stitch the images. 

Download All
0 Kudos
Message 4 of 25
(4,925 Views)

I just got the text to save in the image. The image looks more gray when it is saved in a file vs being viewed in lab view, I don't really understand the code so I'm not sure why. Any ideas? i attached the working VI. 

0 Kudos
Message 5 of 25
(4,920 Views)

I attempted to plug in my working Overlay Test vi into my Overlay and Stitching VI. The same code in the Overlay Test vi that works produces an error in my stitching VI. Thoroughly confused. 

0 Kudos
Message 6 of 25
(4,916 Views)

Actually, an error is occurring in the Overlay Test (vi from forum) VI. That VI has automatic error handling turned off and since you are not manually handling errors by wiring the error wire between the VIs, you just don't see the error.

2017-06-22 10_34_31-Reply to Message - Discussion Forums - National Instruments.png

Comparing your code to the version from the other discussion, the main difference I see is in the image type that you are casting the overlaid image to. In the other discussion, they were casting the image to a U8 instead of a U16. The IMAQ Mask VI will only accept an 8-bit image for the Image Mask input:

2017-06-08 14_54_28-Support.png

 

-Jordan

0 Kudos
Message 7 of 25
(4,897 Views)

Thank you for your reply! I was very confused as how that error was popping up when it didn't in the other VI. I am new to LabVIEW and I am not familiar with all the nuances.

         I have been able to fix the error, and I am trying to combine the different VIs I have created that work independently. The issue I am having now is that the Image with the text overlay that I stitch to the actual image shows up as a gray image without the text when I save it using it within my over arching VI(Tying_Up_Loose_Ends.vi). When, I use StitchingTiff Files_OverlayText VI the image saves as a stitched Image that contains the overlayed text and actual image, which is what I want. I have had to change between signed and unsigned 16-bit grayscale(no exactly sure what the implications of this are), could this be where the issue lies? The image that I edit using BCQ values is how I want it, but the text portion of the stitched images turns all gray with no text, when I use the Stitching+Overlay subVI(not what I want) . I attached the three VIS that I have referenced.

Thanks 🙂

0 Kudos
Message 8 of 25
(4,894 Views)

Does the Stitching+Overlay subVI work properly if you run it on its own rather than calling it from the top level VI? 



Notes for Branch AE:
Please reply to This Post within 24 hours
The US AE is expected to reply to all of your posts within 24 hours. Having this expectation will keep the escalation moving quickly and toward a fast resolution.

You can also use other communication channels: Phone, Skype, etc. to discuss the issue with the US AE. This can help with troubleshooting and quick diagnosis of the issue.

Click here to provide kudos for a post on this page
0 Kudos
Message 9 of 25
(4,877 Views)

Yes, but the text is a grayish color when it is supposed to be white text on a black background. It seems like something is being overlayed on top of eachother when the stitching occurs. The single image with the text is the correct white text with black background, but when it is stitched with the other image the text turns a grayish color. I have attached examples. The Stitched images looks different if it is viewed from the Vision Assistant vs Windows photos. Not sure what this has to do with. 

Thanks

0 Kudos
Message 10 of 25
(4,871 Views)