LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make a program to loop a video feed in LabVIEW 8.0?

To replicate the functionality of the missing Queue function "Lossy Enqueue", you ought to create a small subvi that checks the capacity of the queue, and first removes the oldest element from the queue if it is full before adding the latest image frame. This can be achieved using a combination of Get Queue Status, followed by Dequeue Element if the queue is full, then Enqueue Element.

 

The example you found (Queue stack - LIFO) simply demonstrates how to remove elements from the opposite end of the queue such that you receive them in the opposite order to that in which they are posted.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 31 of 41
(1,644 Views)

Thoric wrote:

To replicate the functionality of the missing Queue function "Lossy Enqueue", you ought to create a small subvi that checks the capacity of the queue, and first removes the oldest element from the queue if it is full before adding the latest image frame. This can be achieved using a combination of Get Queue Status, followed by Dequeue Element if the queue is full, then Enqueue Element.

 

The example you found (Queue stack - LIFO) simply demonstrates how to remove elements from the opposite end of the queue such that you receive them in the opposite order to that in which they are posted.


I'm sure you're reply is as simple as you can make it, but I'm still lost as to how to implement the Get Queue and Dequeue into my program... I looked at the examples and they kind of make things worse as far as me trying to figure out what's going on. 

0 Kudos
Message 32 of 41
(1,621 Views)

I havn't tested this, but I believe it should work.

This snapshot shows a subvi that will operate like a 'lossy enqueue' function.

It first checks the status of the queue. If the maximum capacity matches the number of elements in the queue, then it must be full, in which case it removes the oldest element. It then enqueues the new element.

I've used an image cluster as my element type, obviously you need to replace this with whatever element type you are using.

 

Thoric

 

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 33 of 41
(1,602 Views)
Pic won't show up
0 Kudos
Message 34 of 41
(1,592 Views)
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 35 of 41
(1,578 Views)

Ok so once I open a new subvi how do i connect it to my main VI with my video recording program on it? I looked in the help and it said to make a connector pane but when I right click on the icon on the top right, the option Show Connector isn't there...

 

Also, what do I put for "new image element" and "queue ref in, and out" ?

0 Kudos
Message 36 of 41
(1,564 Views)

You have to click the icon on the Front Panel, not the icon on the Block Diagram pane.

 

On second thoughts, to make this easier for you, don't create a subvi out of the code in my example, just place it directly into your main code. Doing this means the two "queue status" inputs simply come from your existing queue functions, and the third input (new image element) is simply your image as captured from your camera.

 

Although LabVIEW style guides recommend the use of subvis for making neater, easier to understand, reusable code segment, we'll let you off this time 😉

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 37 of 41
(1,552 Views)
Well if we copied your code into our existing program we lose sight of how to get it to run. We would like to use the Subvi to keep things looking simple.. The cluster you made for the new image element is throwing us off, when we create it, the icon in the block diagram looks nothing like yours, is that something from a newer version than 8.0? Everything we are able to create on the block diagram is for a string, and we can't  figure out how to change it to a cluster. The queue ref in are strings and we can't figure out how to change them to a cluster.
Message Edited by PSUstudent on 03-05-2009 02:18 PM
0 Kudos
Message 38 of 41
(1,538 Views)

Ok, hopefully some guidance will help:

 

  • The cluster you can see on my front panel for new image element is not the whole cluster, it actually contains a lot more than this but I reduced the amount of real-estate it occupies to help make the snapshot smaller. The subvi is attached, so take a look at it to see how large it really is (drag the box of the cluster down to see the rest of the contents). It's actually a standard LabVIEW image data control, the same type as used in the graphics format functions (which may not be included in LabVIEW 8.0?).
  • You probably don't actually want this new image element cluster anyway! This is only one example of something to wire into a queue. What are you wiring into your queue functions? Presumably your image from the camera? You need to wire this into the subvi and not what I've created in this example.
  • To generate the queue ref in and queue ref out control/indicator, you need to right click the queue reference wire in your existing code, and select Create -> Control. This will create something similar to what's in my subvi, but it will be specific to your queue element type. You need to cut and paste this new control into the subvi as your queue reference input. Hover the mouse over the block diagram icon in my example and you'll see it's a strict reference to a queue of image elements. Yours will match whatever element type you are using in your code.
  • To create the queue ref out, just copy the queue ref in control on the front panel, right click the new copy and select Change to Indicator, and rename it as queue ref out.
  • Right click the icon of the front panel, and select Show Connector. Wire the two queue refs to the top left and top right. Wire the new image element control to the second left hand input, and wire the error clusters to the bottom left and right.
  • Save the vi somewhere.
  • Drag the icon from the front panel to your existing code and it will be inserted as a subvi. You should then wire up the terminals as required

A lot of this is all very basic LabVIEW coding practice. I suspect you really need to get to grips with the LabVIEW coding style, for which there are many useful examples and tutorials included with the LabVIEW distribution. Creating subvis is one of the first things you'll learn. Just put a day aside to studying all this and it will all become so much easier.
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 39 of 41
(1,526 Views)

Ok I know this is frustrating but believe me I am trying my hardest to grasp this information.. I need to get this to work by the end of April so I can graduate college and this part is our biggest burden.

 

You said I need to wire my image from the camera in place of your new image element cluster,  but I'm having problems doing that. Do I need to make the program that you made into my program as a SubVI? Also, I don't currently have any queue references in my existing code do I?

 

0 Kudos
Message 40 of 41
(1,416 Views)