LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

acquire a large number of frames

Solved!
Go to solution

I'm trying to acquire frames from my camera at the largest FPS possible.

Each image is a 2D array of integers (1040x1392).

 

At the moment, at each cycle I'm appending the image into an array of images:

bigarray1.png

and this array - of course - will grow in memory. 

Its effect can be detected in the slowing down of the acquisition:

bigarray2.png

... which deviates from linear.

What do you suggest? Of course I will need to save periodically the array of images and empty it,

but there are additional tricks in Labview that allow to store more efficiently these kind of structures (arrays of 2D array of integers)?

 

 thank you!

 

alessandro

 

 

0 Kudos
Message 1 of 7
(3,412 Views)

1. Do not use that Value Property Node.  Use a local variable.  It will be a lot more efficient.

2. Preallocate your array with Initialize Array.  You then use Replace Array Subset to add your data into array.  You will need to keep track of where to do the replace.  When your array is full, save off the data to a file and start replacing from the beginning again.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(3,407 Views)

If you need a FIFO, then you could use a Queue. 

And a Queue of fixed size would be even better. 

 

But were is your 2D image array? 

All you are ´placing in a 2D array is a 1D array. 

How are you getting the 1D array to be a image?

0 Kudos
Message 3 of 7
(3,400 Views)

You only showed us a picture of a small part of your VI.  As dkfire noted, it is not at all clear that what you are doing makes sense.  You talk about storing a large 2D array of integers "at the largest FPS possible", but appear to show adding a 1D Array (representing what?) at the front of a 2D array, an enormously "time-expensive" operation (as you need to reallocate space for the slightly-larger array and copy everything over).

 

Of course, we can't see the rest of your code, so we can't understand why you are doing what seems like a completely foolish thing to do, and can't suggest better ways of doing it.  Some (good) suggestions have been made, but they may not really be appropriate to the task that you originally outlined.

 

Out of curiousity, why are you appending images in your array such that "The Last Shall Be First"?  [Of course, while it seems backwards from my limited view of your code, there may be an "Array Reversal" somewhere later ...]

 

My suggestion is that you attach the entire VI, even if it is ugly and takes 20 screens to view (don't worry, many of us have seen much worse).

 

Bob Schor

0 Kudos
Message 4 of 7
(3,377 Views)

 

My suggestion is that you attach the entire VI, even if it is ugly and takes 20 screens to view (don't worry, many of us have seen much worse).

 

Bob, that's the kindest suggestion, thank you! The code I got it with the Thorlabs camera and it is really large (and not ugly, I guess).

The ugly portions are those I'm introducing to customize it! Since I come from VEE and I smashed my face against Labview just a few weeks ago, I'm sure I'm doing a lot of mistakes 🙂

 

> But were is your 2D image array?  All you are ´placing in a 2D array is a 1D array.  How are you getting the 1D array to be a image?

 

dkfire, the image is returned by the camera as a 1D array and then reshaped:

 

bigarray-details1.png

 

... the details of GetPendingImage_SDK.vi up to now I didnt dare to explore!

 

 

Do not use that Value Property Node.  Use a local variable. 

 

Thank you crossrulz, I already read somewhere that propery nodes were considered not efficient... so it is simply a matter of creating a local variable from my indicator? They work the same way as value prop.nodes? What's the difference then?

 

 

Out of curiousity, why are you appending images in your array such that "The Last Shall Be First"?

 

... well Bob, it is just that when I contemplated the array palette for the first time, the "insert into array" tool seemed to be just what I needed... (and no, there is not an "Array Reversal" somewhere later ... 🙂

 

I'm very happy that you guys are helping me discover that there are more efficient ways to do it - so if this time I've been a bit more clear, you are suggesting

- pre-initialized array &  Replace Array Subset, or:

- fixed size queue

 

... arrays I'm already friend with them (more or less) - queues I've yet to meet them, what do you suggest?

 

and many, many thanks for the help!

 

alessandro

 

 

 

 

0 Kudos
Message 5 of 7
(3,348 Views)
Solution
Accepted by topic author alzyx

@alzyx wrote:

 

My suggestion is that you attach the entire VI, even if it is ugly and takes 20 screens to view (don't worry, many of us have seen much worse).

 

Bob, that's the kindest suggestion, thank you! The code I got it with the Thorlabs camera and it is really large (and not ugly, I guess).

The ugly portions are those I'm introducing to customize it! Since I come from VEE and I smashed my face against Labview just a few weeks ago, I'm sure I'm doing a lot of mistakes 🙂

 

Ah, another vital piece of information -- the camera is a Thorlabs camera (you don't mention the model) and you are (presumably) using their LabVIEW Drivers.  One of the first functions that Thorlabs tells you about is "Array to Vision", which converts their (proprietary) Image format, a 1D array, into LabVIEW's more intuitive 2D array of pixels, allowing you (if you choose) to use IMAQ functions to process your images.  I dare say you'll find more Forum readers with experience with IMAQ than with experience with the Thorlab functions ...

 

So where is the attached VI?

 

> But were is your 2D image array?  All you are ´placing in a 2D array is a 1D array.  How are you getting the 1D array to be a image?

 

dkfire, the image is returned by the camera as a 1D array and then reshaped:

 

See my previous comment about "Array to Vision".

 

Out of curiousity, why are you appending images in your array such that "The Last Shall Be First"?

 

... well Bob, it is just that when I contemplated the array palette for the first time, the "insert into array" tool seemed to be just what I needed... (and no, there is not an "Array Reversal" somewhere later ... 🙂

 

When attempting to build a 2D array by adding a 1D array to the beginning or to the end of an existing (even if empty) 2D array, the much-more-natural-and-intuitive-function-to-use is "Build Array" (hey, it even sounds logical).  And, as a bonus, when you wire the 1D array into it, you can choose in a "natural" function whether to build the array in "normal" or "reverse" order.

Build Array.png

 

Bob Schor

 

Message 6 of 7
(3,332 Views)

>Ah, another vital piece of information -- the camera is a Thorlabs camera (you don't mention the model)

> and you are (presumably) using their LabVIEW Drivers.  

 

sorry, I didnt think relevant to mention the model...

 

> One of the first functions that Thorlabs tells you about is "Array to Vision", which converts their (proprietary) Image format,

> a 1D array, into LabVIEW's more intuitive 2D array of pixels

 

oops I dont know what you're talking about ... this reports nothing useful. The thorlabs software I got was not documented at all!

 

> allowing you (if you choose) to use IMAQ functions to process your images.

 

 

I heard about IMAQ, but at my lab is not available, damn

 

 

> So where is the attached VI?

 

here it is - it calls a lot of thorlabs stuff however. Must I send even those files?

 

alessandro

 

 

 

 

0 Kudos
Message 7 of 7
(3,320 Views)