From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer/consumer - Video image gone before processing.

Solved!
Go to solution

Hello everyone, I am very new to using queue's in labview (2011), and my first one is giving me problems.

 

I'm using a producer/consumer loop to grab 2 images from 2 videos, say every 5 seconds, and then process it. The image processing part works great when I tested it seperatly, where the inputs were just file paths to the images. But then I connected it to the video acquisition part, and I got some problems.

 

The image would successfully go into the consumer loop at 5 seconds, but the very first thing was an IMAQ Morphology, and it never came out of the morph. All images after that were just blank, and all the numbers were NaN.

 

I made the problem simpler, much simpler, where the only thing in the consumer loop is a simple rotate the frame 90 and 180 degrees. This caused the same problem. An image comes into the consumer, but never continues after the first action (in this case, rotating). This tells me that something is wrong with my queues or producer/comsumer basic structure, and I can't figure out what it is. I've attached the simple rotate vi, along with a picture of it. Any help would be great, thank you.

 

-Mark

Download All
0 Kudos
Message 1 of 8
(3,742 Views)
Solution
Accepted by topic author markconigliaro

Your problems come from the fact that IMAQ images are references to images in memory somewhere, rather than the actual images.   You aren't actually passing images through your Queues, just references.  So you're probably overwriting the image with a new image from the camera before your rotated image gets displayed.  

 

This is an unfortunate feature of IMAQ images; you can't treat them like "data" that you can pass around.

Message 2 of 8
(3,692 Views)

Thank you very much. That put me on the right track, and I think that's exactly what's going on. But there's still a problem. In my research with that idea, I found a very posmising example:

 

http://forums.ni.com/t5/Example-Program-Drafts/Community-Example-IMAQdx-Ring-Buffer-Producer-to-Proc...

 

I tried modifying my code with that format, but I got the same problem. So I then stripped everything away, simplified the code as much as I could (even took out a camera, so now only using 1), and basically copy and pasted that example code to see if it works. And again, the same problem. Before the rotate, I can see the image, after the rotate, the image is blank.

 

I'm sure this is the method I should be using, but I must have something small going on because I can't find it. I've attached the simplified code along with a screenshot (the number attached to the for loop on the far left is 10, I've tried 5 and even 1000). Thank you again.

Download All
0 Kudos
Message 3 of 8
(3,665 Views)

I think your test2 image is being erased for the next rotation immediately after you finish the previous rotation.

 

IMAQ displays are strange.  They tend to display the current version of the image, not the version that you had when you sent it to the display.  You can fix this by checking the "Snapshot Image" property (right click on front panel), which makes a copy of the image when it is sent to the display.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 8
(3,660 Views)

I tried moving the IMAQ Create for test 2 around, and also getting rid of it completely, and it still has the same problem. I've even replaced rotate with a handful of other VIs (such as morphology and shift) and they all have the same problem. I also checked off the snapshot option.

 

If anyone can't find a problem in the software, could it possibly be a hardware issue? The program is being made on a 32 bit machine, and I have to build an exe so it can run on a 64 bit machine, but the 64 bit machine has to run the 32 bit run time engine (the 64 bit run time engine didn't work). I don't know, I'm just throwing out that possibility because I'm all out of ideas for the software side of this.

0 Kudos
Message 5 of 8
(3,640 Views)

Update: I was able to bring 1 of the cameras to my (32 bit) computer to do some debugging, I plugged it in, ran the program, and it worked. There were absolutly no changes from the last VI that I shared in this thread. I even rebuilt the working program and brought it to the other (64 bit) computer and it had the same problem (post rotation the image was gone). Now that this seems like more of a computer issue, I'll go in a bit more detail.

 

My computer upstairs is a Windows XP Professional 32 bit computer with a version of LabView where I can edit code. The computer downstairs is a Windows 7 Professional 64 bit computer that can only read LabView executable files. I had to install LabView runtime engine 2011 SP1 32 bit version onto the computer downstairs. I edit my code on my computer, build the application (tools, build application, default everything, build) and bring it downstairs to the 2 camera setup. I run the program with only 1 of the cameras as input, and I get the problem where after the rotation, the image display is empty (looks as if you just created an image display, grey). But when I brought 1 camera upstairs to my computer, I plugged it in, and it ran the same code no problem, with an accuratly rotated screen in the display.

 

At this point I have no idea what's going on. If this question has now gone too far from the original subject, I have no issues with asking this new question in a seperate thread somewhere else. But if anyone has any ideas, I'd love to hear them. Thank you.

0 Kudos
Message 6 of 8
(3,635 Views)

It might be because you need a runtime license to use NI Vision in an executable.  I think your Rotation VI is in the NI Vision package (at least, it isn't installed on my computer, which doesn't have NI Vision).

0 Kudos
Message 7 of 8
(3,612 Views)

That may very well be it. This was the exact place I downloaded the engine from:

 

http://www.ni.com/download/labview-run-time-engine-2011-sp1/2897/en/

 

All I did was install that to the other computer, I didn't know there also needs to be a license. I'm assuming the license doesn't include video, just image manipulation. Because the producer loop runs just fine, where it shows the video in a popup display box, but it's the consumer loop that causes problems, mainly, the rotate, morphology, and shift VIs I've been testing with. The computer also has a basic program that just displays the video, and saves the image when you click the button, but that one was made using LabView 2014. My job was to add image processing onto that program (but in LabView 2011). So am I right in saying that the video stuff is "free", while image processing needs a license. 

 

If that's the case, then this problem will be easy to fix, if I'm wrong then please correct me. I'll be away from work for a few days for holiday break, but I'll be sure to update when I get back and get ahold of some licenses. Thank you again

0 Kudos
Message 8 of 8
(3,607 Views)