LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store image from a "for" structure

Hey everybody !

 

For a project, i need to take four different images and compare them later. So I've made a structure "for" to enable me to change parameters for each image. My problem is I don't really understand the way "autoindexation" works. When I try to create an indicator after the structure, there are four images but they're all the same. I've read in a post that it's a problem of addressing the image but I don't know how to actually get to the image itself.

 

Here is the program at the moment:

 

I hope my problem is not too complicated to solve.

 

Thanks in advance !

Vision 3D v17.05.jpg

0 Kudos
Message 1 of 4
(2,125 Views)

When you autoindex on the output of a for loop, each iteration of the loop will form one element of the resulting array.

In your case these elements are images that are all the same.

I don't know what the sub-vi with the 'play' icon is doing, but each time the iteration runs it is being passed the same parameters so presumably will always do the same thing... therefore always output the same image. I would guess that in order to get different images you would need to provide different parameters.

The other option is that is is acquiring images so quickly that they all look the same. Try inserting some timing into the loop to pause between acquisitions and see if that makes a difference.

 

Are you expecting the other sub-vi (with the default icon) to interact with the other sub-vi in some way?

 

If you post an example of your code it would be easier to help.

 

Ian

0 Kudos
Message 2 of 4
(2,111 Views)

Hi,

 

I haven't worked on IMAQ yet but I think the IMAQ Snap.vi inside the for loop gets the same image from the source in all the 4 itrations. There is nothing wrong with the auto indexing of the for loop.  The problem is because the image is read only once from outside the while loop. If you want to read 4 different images you should place the White color IMAQ vi (Which i suppose gives the input image) inside the the for loop.

 

Regards,


Nitzz

(Give Kudos to good answers, Mark as a solution if your problem is Solved;)) 

0 Kudos
Message 3 of 4
(2,109 Views)

Hi,

 

The vision system works like this:

you have a source image and a destination image, VIs reads from source image and write to destination image.

 

In your case, you only created one destination image, and each loop will result in writing the new image to the same destination address. And this is why you are getting four same images.

 

There are two solutions I think.

1.create four destination images using IMAQ create.

2.using IMAQ ImageToArray VI after you get the image from your camera, and passing the arraies out of the loop.

 

0 Kudos
Message 4 of 4
(2,107 Views)