ā11-19-2017 07:35 AM - edited ā11-19-2017 07:38 AM
Hi,
I'm having a problem with a "RawImage" (Unnamed Type 1) that is sent from Vision Builder 2015 (inspection mode) to LabVIEW using a Shared Variable;
The system works in such way that a picture is taken each time a "sensor" gets triggerd and the time between each trigger depends on the running speed of the process (conveyor). The way the LabVIEW application works is by storing 10 pictures, 2 and 2 at the time, in an array.
This two pictures then gets displayed in two seperate "Image Indicators", so that the first picture is shown in the left indicator and the second in the right indictor and so on (left: 1 - 3 - 5 - 7 - 9 | right: 2 - 4 - 6 - 8 - 10).
But the problem is that sometimes the pictures get mixed, so that they are displayed in the wrong indicator or same picture in both.
This seems to be a synchronization problem, but im not sure...
I can not share the VI, but I can show a "picture snip" from the "Image Update" loop that receives the shared variable (RawImage) and displays the pictures in the front panel.
Any idea what causes this problem and how I can solve this without having to do major changes (since the rest of the applcations works fine)?
ā11-19-2017 12:32 PM
When Shared Variables were first introduced (LabVIEW 8-early, as I recall), they seemed like a great way to transfer data between independently-running LabVIEW machines, such as LabVIEW Real-Time. Nope, a bad idea, never worked (for me) reliably. Network Streams, on the other hand, are very reliable. And, for Images, having IP Cameras obviates the need for any Network code, as the images just get read from the Cameras using IMAQdx.
You don't say much about the Cameras and you seem to be using Express VIs (instead of the IMAQdx functions) to acquire your images. I think (based on personal experience) that it would be straightforward (assuming more knowledge of your hardware) to set up two data streams, one from each camera, and display these streams on two Image Displays. Now the "getting the images mixed up" problem goes away -- Camera 1 always goes to Display 1, Camera 2 to Display 2, so the only "disparity" possible is that the two images get out of time synchrony. But with a reasonable rate of Image Acquisition (say 10-30 frames/second), this shouldn't be a problem.
Bob Schor
ā11-21-2017 01:57 AM
There is only one camera that takes multiples pictures, so two data streams is therefor not an option.
You can see in the image above that i'm using: IMAQ Create and IMAQ Copy (no express?)...
The problem seem to be solved, with only a few times where the image ends up on wrong indicator, by setting a lower wait time (in this case 5ms).
So there is something regarding the speed of the "Image Update" loop, since this problem only occurs when the conveyor is running at full speed.
(If the wait time is set to 200ms, the problem occurs more often, even at lower conveyor speeds).
ā11-21-2017 07:35 AM
@Avanti wrote:
There is only one camera that takes multiples pictures, so two data streams is therefor not an option.
You can see in the image above that i'm using: IMAQ Create and IMAQ Copy (no express?)... Not really -- you attached an image, which is tedious to study (not to mention an eye-strain) instead of helping us out by attaching your actual VI (which allows closer inspection and even testing).
If there is only one camera, that is perhaps an even better reason to use Network Streams, as this guarantees that the Images in the Stream are in exactly the same order as they were in the Camera. When receiving the Images, you send all the "odd" Images to one display, all the "even" images to the other display.
I haven't bothered examining the picture you attached (I'll wait for a VI to examine), but using Streams creates a Producer/Consumer-type Pattern where the timing is set by the Producer -- the Consumer (the Display) will do its best to "catch up" to the Producer, but doesn't need any "Waits" as it is essentially "clocked" by the speed that the Producer puts Images into the Stream. One less thing to worry about.
Bob Schor
ā11-22-2017 06:34 AM
@Avanti wrote:
I can not share the VI, but I can show a "picture snip" from the "Image Update" loop that receives the shared variable (RawImage) and displays the pictures in the front panel.
I will look into the "Network Stream" option...