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: 

Loading pictures array

Hello,
reading the files one by one fast is imposible, because my pictures are mostly saved in special binary file. I thought it would be possible to load these picture into the main memory once and than just use them. Thats why I tried to use global varriable, but it makes another copy of itself every time I want to use it and there is not enough memory in main memory to make another copy and it slows down very much by swapping. So the only way you are suggesting is to siply read one  by one.

Tomas
0 Kudos
Message 11 of 16
(767 Views)
Hello Tomas.
A customised "functional global variable" should be a good solution. My idea is:
(1) Keep the array of images in the shift register of the functional global variable (e.g.   as a 3D-NumericArray   or   as an Array of Cluster of Image).
(2) Allow for reading and writing of one element of the array by the functional global variable. (= Do not pass the contents of the shift register to the input or output terminals of this VI. The array of images should only "live" in the shift register.)

This solution should be memory friendly and come with a good access time to each image.
Hope this helps, Guenter
0 Kudos
Message 12 of 16
(757 Views)
Hello Guenter,
I don't understand very well what to do. Your idea seems very good but I have no idea how to do it.
I don't know how to keep the array of images in the shift register. Do you mean to load all the pictures once and then keep them somehow in the 3d array in the shift register and read out only image that I actually need? If this is the case, I did try it (if I understand it) First I load pictures into the Global variable, then pass this global variable into the different VI (the whole 3D arry od pictures) and input of this VI is number of picture and output is one picture. But when I use this VI more often, for different tasks it seams to load the whole 3D array into the memory again and it slows down a lot.

Thank you

Tomas
0 Kudos
Message 13 of 16
(739 Views)
Hi Tomas,
this VI could look like the example I attached. It uses uninitialized shift registers, which is a very common way to store data at high performance. Please search the LV Help for uninitialized shift registers for a better understanding.
This VI is a raw sketch, better would be to store it in an Array of clusters with arrays containing, this reduces memory size and don't have to be slowlier (there is an ongoing thread between Ben & Shoneil about this topic).
Greets, Dave
Greets, Dave
0 Kudos
Message 14 of 16
(733 Views)
Hello, I have tried uninitialized shift register and there is a problem with memory, I have 1GB main memory and after 80MB of loaded pictures LabVIEW crashes with memory problem, is there any way how to make this VI to use disk swap? Or some other way to load more data (maximum would be 200MB)

Thank you very much

Tomas
0 Kudos
Message 15 of 16
(701 Views)
Hello-
When you say that LabVIEW crashes with a memory problem, what is the error that you receive, if any? Does LabVIEW simply close down? Is there any error message associated with the crash?
 
Thank you,
Emilie
Applications Engineer
0 Kudos
Message 16 of 16
(679 Views)