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.
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.
11-27-2014 10:49 AM
Hi all,
in my applications I frequently deal with quite large images, 90 Megapixels or larger. We have to do defect detection on those images. Once we found them we mark the positions using coloured overlays. Because of the "Overlay ROI" function I am able to overlay rotated rectangles. For visualising this is all quite well. However when having to save this information to an image file I get a bit of a problem: Merging the overlays quadruples/triples the amount of memory taken up in RAM and on harddisk, as the IMAQ reference for the merged picture has to be of type color U32 instead of my U8 greyscale (and on disk will be 24bit PNG/BMP instead of 8Bit).
In order to keep the memory figures on a normal level I started to use an extra IMAQ reference of type U8 greyscale where I draw all the shapes using the IMAQ Draw functions. Then I add the number of different colors of drawn overlays to the image pixel values which leaves me free to define a user palette where the first n entries are the colors of the different overlays and the rest remains greyscale (unnoticebly increasing the brightness of the U8 image). Then I save the image as U8 using the user defined palette. So far so good. What stumps me here is that there seems to be no native "LabVIEW"-way to draw a rotated rectangle or oval.
I have come up with a couple approaches to tackle this problem, but maybe I am missing a great built-in function here:
I would appreciate any hint if there's an easier way to do what I want to accomplish
11-28-2014 03:23 AM
Hi Comrade,
i find it pretty hard to understand what you are doing. Could you please provide some pictures for a better understanding?
11-28-2014 03:37 AM
Sorry, I seem to have overloaded you with information. The question is actually quite a simple one:
Is there an easy, ready-made way to DRAW (NOT overlay!) a rotated rectangle to an image other than:
I'll think on how to illustrate that, but actually this is not about visualisation but about performance (concerning processing time) and memory usage.
11-28-2014 04:10 AM - edited 11-28-2014 04:10 AM
Hi, Comrade,
are you working with the vision assistant or with the vis? This is just a shot in the dark but maybe you could check this vi:
Draw Text in an Image - National Instruments
http://www.ni.com/example/26905/en/
11-28-2014 04:29 AM
Well, of course, IMAQ Draw functions are neat. But as I pointed out in my initial post - they do not support the drawing of a rotated rectangle.
Please find in the attachment a VI and a simple test image. This resulting image after running the VI shows what I receive using the overlaying technique. The question is: What is the simplest way (in terms of coding AND performance) to turn those overlay shapes into pixel coordinates that I can use to draw these shapes into an image.
The final goal here is to reduce the amount of harddisk space used up by saved result images via applying a user defined color table to a U8 image as opposed to just savig a color image with all the overlays merged, as described above in the initial post.
11-28-2014 07:13 AM
Why don't you create the Overlays, merge them with the image and re-convert the image back to 8-bit for saving.....? Seems like the easiest way to do things. You'll only have the 32-bit image briefly in memory.
Shane
11-28-2014 10:40 AM
Sounds a bit like my proposal 1 in the initial post. When testing it proved easier to code than I originally thought it would be. I came up with the attached VI (added the necessary parts to the one I posted earlier. Maybe there's an easier way but thanks anyway Intaris!