06-20-2017 01:14 PM
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
Solved! Go to Solution.
06-20-2017 01:24 PM
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?
06-21-2017 12:50 PM
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:
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
06-21-2017 01:43 PM
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.
06-21-2017 02:28 PM
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.
06-21-2017 02:49 PM
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.
06-22-2017 01:29 PM
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.
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:
-Jordan
06-22-2017 02:30 PM - edited 06-22-2017 02:44 PM
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 🙂
06-23-2017 11:32 AM
Does the Stitching+Overlay subVI work properly if you run it on its own rather than calling it from the top level VI?
06-23-2017 01:15 PM
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