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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Overlaying thousands of images

Solved!
Go to solution

hey all,

 

i have an 1D array with thousands of pictures and i want to overlay them all in one as fast as possible.

i've tried different approaches ... so far the best one i found is to use "concatenate strings" but still too slow for my need.

 

Overlay-Imagesd.png

 

 anyone got any idea?

0 Kudos
Message 1 of 14
(3,786 Views)

The subVI you use (Draw Point.vi) is not a reentrant VI, so parallelism doesn't help.

How fast you need?

 

i have an 1D array with thousands of pictures

Actually, that's 1D array of points, not pictures.

Why not use chart/graph ?

 

George Zou
Message 2 of 14
(3,750 Views)

thx for the reply, zou!

good to know that parallelism doesnt work here ... it actually slows it down by a factor of 2 i've just realized.

 

i have an 1D array with thousands of pictures

Actually, that's 1D array of points, not pictures.

Why not use chart/graph ?

 

yeah it's a 1d array of points ... but in pictures. so thousands of pictures with one black pixel each.

i know chart/graph would be way easier here ... but i've got to implement this in an already existing VI and everything that's graphic there is handled as a pattern image. besides i need to to export the pattern imager (respectively the 1d array of points) as *.bmp file

 

the pattern/picture i want to draw consist of e.g. 4.000.000 points (x/y coordinates).

so i need a way to draw all those points in one picture ... ideally in under 5minutes.

in my first version i overlayed picture by picture through a shift-register in the for-loop. that was way too slow.

 

 

0 Kudos
Message 3 of 14
(3,741 Views)

Put the content of the subVI in your VI.

Try the modified VI.

George Zou
Message 4 of 14
(3,721 Views)

How many colors are there? Initialize a 2D array of U8, then replace elements according to the coordinates. Create a color map that contains the 256 colors you have and form the image at the end using flatten pixmap. Or use draw unflattened pixmap directly if it is just for display! (You could even us an intensity graph!).

If you have more colors, do the same with U32.

 

Can you attach a VI that contains some typical inputs?

Message 5 of 14
(3,694 Views)
Solution
Accepted by topic author re-fuse

Here's what I had in mind....

 

 

 

Modify as needed. As I said, you can use draw unflattened pixmap to create an image from the result or add it to an existing image.

Download All
Message 6 of 14
(3,688 Views)

Same thought as Altenbach, but I add my snippet anyway since I also have some benchmark figures that might be interesting.

With 4 million points in a 4000*4000 image this took less than 30 s on my crappy laptop.

If your points are already ordered in some way it could be done my faster, I believe

 

Change points.png

Message 7 of 14
(3,681 Views)

You are adding 4 million pixels (quite a few probably in duplicate), which is significantly more than "thousands". I would expect to solve original problem to be much, much  faster. (<<<1s) 😄

0 Kudos
Message 8 of 14
(3,673 Views)

You are absolutely right, I got carried away and did not read the orginial post carefully so I mixed up the numbers. I agree, I tested it again and it will take in the order of 1/10 s

0 Kudos
Message 9 of 14
(3,665 Views)

Using an array of 4M coordinates on a 4kx4k array takes about 18ms here. Drawing the flattened pixmap is the slow step and takes hundreds of milliseconds. I would stay away from picture functions and use simple 2D arrays.

0 Kudos
Message 10 of 14
(3,662 Views)