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: 

Create and fill an array with IMAQ images for group averaging

Solved!
Go to solution

Hello,

 

I have been struggling on a problem for a couple of days now, and I am looking for a bit of help on a "simple" aspect of NI LabVIEW and NI Vision.

 

First, I will just give the context of my problem : I have a camera (set on a microscope) which is grabbing images from my sample. I need to record the raw images directly obtained by the camera (so without any pre-processing) because I have some routines of post-processing to apply on them. However, while and in between recording, I need to move in my sample and either look for event or track them (manually). So I need in the same time to pre-process the signal and display it, so I can have a good visualization of the sample.

For this, I am required (by the different natures of the samples I usually work with) to switch between two types of pre-processing for visualization: (i) correction by the subtraction of a constant background image (taken in a blank part of the sample). This part is already done and working perfectly fine. (ii) correction by group averaging on N frames. And this is the part I have trouble with.

 

So the second type of correction is pretty simple in its description: (1) I collect N frames, (2) I average them (using the IMAQ Compute Average Image.vi so far), (3) and then I take the N+1th (raw) frame and divide it by the average computed just before. Then I restart from (1).

Using the examples and other topics ( for example here ), I have managed to make this running with a For Loop and a Ring acquisition.

The problem is that, until the foor loop is completed on the N frames, the program does not do anything else. Which means it does not display or record the raw frames anymore. So my frame rate becomes (true FPS) / N, which is terrible for my application.

 

I have tried several ways to do it, by adding pixels values of images and finally dividing them by N (with IMAQ Add.vi and so), but it does not work at all (I only got a black screen on display).

I feel like I could do this with a very simple way, by inserting directly the N IMAG Images in an array, processing it with the IMAQ Compute Average Image.vi on the Nth frame and re-initialising the array at the end. After all, IMAQ Compute Average Image.vi is designed to work with Image array (cf Online description). However, I cannot find anyway to create such array of images than by using a For loop (which is slowing my acquisition down drastically).

 

So how can one create an IMAQ image array without using a For loop (such as in the example given above)? Could it be done with a While loop and a shift register for example, so the display and acquistion of my raw images are not impacted by the group averaging?

 

Best

PS: I do not include a VI because I don't think it would be really relevant regarding my question, but I can send my test one if needed

0 Kudos
Message 1 of 5
(2,923 Views)

I have solved the problem myself. As expected, the solution was simple

0 Kudos
Message 2 of 5
(2,912 Views)

@VWalter wrote:

I have solved the problem myself. As expected, the solution was simple


Then consider helping others by actually providing the solution. And also mark that post as solution...

 

If you don't you're wasting peoples time as we keep opening this thread trying to help...

0 Kudos
Message 3 of 5
(2,885 Views)
Solution
Accepted by topic author VWalter

wiebe@CARYA

 

If you don't you're wasting peoples time as we keep opening this thread trying to help...


Being polite never hurt anyone as far as I know...


My resulting VI is attached, the solution is provided inside

Message 4 of 5
(2,878 Views)

@VWalter wrote:

wiebe@CARYA

 

If you don't you're wasting peoples time as we keep opening this thread trying to help...


Being polite never hurt anyone as far as I know...


My resulting VI is attached, the solution is provided inside


That was mend to be factual, sorry if it came over harsh.

 

Kudo's for posting and marking the solution.

0 Kudos
Message 5 of 5
(2,871 Views)