Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Draw Text scales poorly with image size

I'm using IMAQ Draw Text to add a timestamp and some other information to a video stream. The function works correctly; however, on it takes almost 3.0 ms to add a few lines of text to my 1024x768 U8 greyscale images on a fast machine. When I run the DrawText Example.vi in \examples\Vision\2. Functions\Image Management, I find that it runs almost instantaneously on small images, but hundreds of times slower on large images. On a different computer, I find it takes about 0.15 ms to add text to a 633x466 image, but 1.5 ms to add the same text to a 1024x787 image using DrawText Example and the profiler to analyze running time. This increase is extremely nonlinear in the number of pixels. Why is this? Is there any way to quickly draw text onto a large image? Thanks.
Jason Rolfe
0 Kudos
Message 1 of 4
(3,484 Views)
Hi Jason,

Unfortunately, what you say is true, and I am not aware of a faster way to add text to an image. Currently the function is making an additional copy of the image, slowing the process down. Fortunately, this problem has been noted several times in the past and R&D is actively working on a fix for it. If the function is currently a showstopper, it might be faster to note the time of each frame in another file, and add that information to the video stream in post processing.

Hope this helps,

Robert Manion
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(3,474 Views)
Rolfe -

Have you tried using the IMAQ Overlay Text VI to overlay the text on the image, then make it part of the image with IMAQ Merge Overlay? This might be faster than IMAQ Draw Text.

Greg Stoll
IMAQ R & D
National Instruments
Greg Stoll
LabVIEW R&D
0 Kudos
Message 3 of 4
(3,468 Views)
Hello again,

It's possible that this could be faster, but my experiences have shown that Overlay and Merge are often pretty slow as well. Definitely give it a try though.

If you are working with fairly large images, you might try extracting the area of the image you wish to create text on. Use the draw text function on this smaller portion of the image, and replace the original image subset with the image that includes text. To copy the extracted image back into the large image, I would suggest the IMAQ Imagetoimage function.

In the case of very large images, this workaround is often faster. Good luck, and let us know how it goes!

Robert Manion
0 Kudos
Message 4 of 4
(3,456 Views)