Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Imaging, Image Names, and Looping with LabVIEW

I am having an problem with LabVIEW when imaging with a PCI-1428 framegrabber card. I have attached the VI that I am currently using. What I am trying to do is image with the camera, and have the computer save the images as a different name for each image taken (with a .TIFF extension). I have been using a for loop, located in the lower right hand corner of the block diagram, to increase the image number by one every time an image is saved. However, when I have a constant or a control wired to the N value of the for loop, the camera takes one image, then the computer saves that image a number of times (equal to the N). However, this was not the goal of the for loop. Does anyone know what is going wrong, or how I can wire the for loop (or another looping option) such that for every image that is taken it will be then saved and have different name?

 

Thanks,

 

Noah

0 Kudos
Message 1 of 5
(3,749 Views)

Hi Noah,

 

Thanks for posting!  The image reference is a pointer to a memory location so everytime an image is taken, it overwrites the data in that memory location. When your while loop is complete, the image location contains the last image taken and that is what I suspect is being saved repeatedly. 

 

If you save to file while inside the while loop that should save whatever image is currently in that memory location. 

 

I hope this helps.

 

 

Tejinder Gill
National Instruments
Applications Engineer
Visit ni.com/gettingstarted for step-by-step help in setting up your system.
0 Kudos
Message 2 of 5
(3,727 Views)

Hi Tejinder,  
 
Thanks for your input. Are you saying that if I put the save function (the various blocks that I am currently using) in the first while loop, that the images will be saved properly? If not, do you have any ideas on how I can set up a loop in the VI so that every image that is taken by the camera gets saved? 

 

Thanks,

 

-Noah  

0 Kudos
Message 3 of 5
(3,692 Views)

Hi Noah,

 

If you save inside the while loop it will be saving whatever image is currently in that memory location.  And each time the loop iterates the memory location contains the next image and therefore each time the save function is called it will save a new image.

 

 

Tejinder Gill
National Instruments
Applications Engineer
Visit ni.com/gettingstarted for step-by-step help in setting up your system.
0 Kudos
Message 4 of 5
(3,663 Views)
Do something like this
0 Kudos
Message 5 of 5
(3,646 Views)