LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger button click programatically after a specified time

Solved!
Go to solution

I'm trying to make an application that doesn't require the user to make a click on a button, in order for the action to occur. I need this action to occur every 500 ms, but the thing is I don't know how to do this programatically, since I'm new to labview. what I want to do is take a picture from my web cam every 500 ms, and in another windows, I want to capture the entire video. So I would have a live video stream on one side and a picture from that live stream on the other side. any examples will be greatly appreciated. 

Thanks!

 

0 Kudos
Message 1 of 33
(3,978 Views)
Hi nando1988,
-First you need to understand how to capture video and images from webcam.
-Please check examples bundled along with labview for grab(Continuous capture) and snap.
-For examples>>Help>>Find Examples>>Search for grab and snap.
-Check this for an example i added. In that vi, whenever you click button, at that instance the captured image will be saved.
http://forums.ni.com/t5/LabVIEW/Capture-image-from-video-live-streaming/m-p/2663925#M793602
-In your case it will be every 500ms it needs to capture image. Using proper timing vis change the value of boolean control to get it done.
Thanks
uday
0 Kudos
Message 2 of 33
(3,962 Views)

I already have an example, that captures video and an image through a button click, but now I want to modify that code, so that it captures an image after 500 ms.

I tried using a while loop and a timed loop inside of it, so that it is always running, and takes a picture every 500 ms. The thing is that if I do that, only 1 image is taken and the video freezes.

I also tried only using a timed loop, but the same thing happens.

Please tell me what can I do to fix this.

And if you could give me some code, I would be really thankful.

0 Kudos
Message 3 of 33
(3,952 Views)
I don't understand why you need any sort of button to do a continuous acquisition. I don't see any reason to have a timed loop inside a while loop. I don't see much reason to have a timed loop at all. A straight forward state machine or even a simple while loop would seem to suit your needs.
0 Kudos
Message 4 of 33
(3,947 Views)
-You said you have an example-then you should post it and explain the problem instead of asking for a general solution.
-Why do you mix while loop and timed loop?? Timed loop has a while loop. you don't need extra while loop for it.
-Please understand how timed loop works in multi core programming. Read it here
http://www.ni.com/white-paper/6099/en/
-I generally don't prefer use timed loop in pc. Please read Timed loop in above link then you might find why its freezing.
-Again if someone wants to "fix this" they need to see what you have done and then they can fix.
-Did you try the above code which i mentioned? did you understand the logic there?
Thanks
uday
0 Kudos
Message 5 of 33
(3,942 Views)

This is the example I'm using. The part that I modified, but with no success, is the one that has the timed loop. The problem I'm having is that I only get 1 image and the video freezes.

What I need is to keep watching a live video and for an image to be taken every 500 ms.

Please help me fix this.

Thanks in advance!

0 Kudos
Message 6 of 33
(3,923 Views)

Having the timed loop is just silly. You don't understand LabVIEW and data flow. The inner loop just cycles continuously without getting a new capture. Your main while loop needs a Wait (ms) set for 500ms to capture at that rate. I don't have imaq installed at this point so I can't comment on the rest of the code.

0 Kudos
Message 7 of 33
(3,914 Views)

How can I have a live video on 1 side and also take a picture of that video every 500 ms, with the same camera?

0 Kudos
Message 8 of 33
(3,897 Views)
I understand now what you need. I would suggest a product/consumer architecture. In the consumer loop, every 500ms do the single frame capture. You could also try an elapsed time function in the main loop but the live stream would get interrupted.
0 Kudos
Message 9 of 33
(3,889 Views)
-Please read context help of IMAQdx grab>> Acquires the most current frame into Image Out.

Thanks
uday
0 Kudos
Message 10 of 33
(3,869 Views)