Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Using While loop to save Images

I have LabView 7.1 with Vision and am acquiring 60 frames per second (the max camera frame rate) with a PCI-1422 board. I use the Imaq Create VI hooked to a while loop. An Imaq Grab Acquire VI is inside the while loop. Sometimes I don't need 60 images per second. So I look at the while loop counter and save an image every sixth execution of the loop. When I use the counter in this way to save every 6th image, more than 10 images are saved every second (approx 340 frames in 30 seconds). However 60 images per second works fine. Anyone know why?
0 Kudos
Message 1 of 8
(5,878 Views)
Hello Air Force,

The behavior you are describing sounds really strange.  Without looking at your code, I have no idea why your application would be doing that.  Here is a quick and messy example of how I would implement a grab that saves to a file every sixth time.  Let me know if this helps with your problem.
S. Arves S.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 8
(5,858 Views)

I solved the problem by using sequencing. However I am not sure why i needed to do this. I will attach this simple VI if anyone has a clue why the sequence was needed.

I attempted to attach 3 referenced tif files, but it was not allowed. I tried using png files previouslly but NI changed the format and they did not work on different Labview versions. This support site is a pain in the ass.

AF1

0 Kudos
Message 3 of 8
(5,846 Views)
The problem your were having is a result of timing between the multiple threads you have running.  LabVIEW assumes that if you have multiple threads that you want them to run as quickly as possible.  The sequence structure in your code is forcing the top thread to run locgically as a single command and therefore in the correct time, speed and order.
S. Arves S.
National Instruments
Applications Engineer
0 Kudos
Message 4 of 8
(5,816 Views)
Hello Arves, the example code doesnt work properly, it mention about invalid parameter..can i know why?

0 Kudos
Message 5 of 8
(5,456 Views)
Hi sabiqi,

The error message you are receiving is most likely a result of LabVIEW not being able to communicate with your image acquisition interface.  On the Front Panel of the example, the string in the Interface Name control must match the interface name of your NI-IMAQ device as it appears in Measurement & Automation Explorer (MAX).

If these do match and you are still receiving this error, please reply with the following information:

1)  The exact text in the error message, including an error number if it exists.
2)  The version of IMAQ drivers which you are using
3)  The type of image acquisition board you have
4)  The version of LabVIEW you are using.

Thanks.


Rishee B.
Applications Engineer
National Instruments



0 Kudos
Message 6 of 8
(5,434 Views)
Hello Risheeb,

I would like to thank you for your support,

1) Error- 1074395997 occured at IMAQ WriteFile invalid parameter,
     Possible reason(s):
     IMAQ Vision: (Hex 0xBFF604A3) Invalid parameter.

2) NI-IMAQ Vision Run-Time Engine 7.0.0

3) PCI-1405

4) LabVIEW 8.5 (professional Development System with mathscript)


I really need this code for support my project, please help me
0 Kudos
Message 7 of 8
(5,426 Views)
Hi sabiqi,

This example VI is designed to continuously acquire images and save every sixth image to a folder on the hard disk.  This error seems to be occurring when a folder path is not provided in the control on the Front Panel for the images to be saved to.

I replaced the path control in this VI with a File Dialog.  This way, when you run the VI, a dialog will pop up.  You can then navigate to the folder you would like the images saved to and press the Current Folder button.  This should ensure that a valid folder is provided every time the VI is run unless the dialog is cancelled.  Please try out this new code and let me know if it resolves the error you were receiving.  Thanks.


Rishee B.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 8
(5,407 Views)