LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use local variables to pass an image mask correctly

I'm kind of new to labview but i'll try to explain the problem as best as i can: I'm trying to pass an image mask (basically an image) to the next iteration of a while loop using local variables. I think the image passes through the loop with the local variable but i can't read from it correctly for some reason. And I don't think the problem has to do with local variables because i've tried using shift registers and that didnt work either. I think the problem is that you need to do something to read the image correctly again, like using IMAQ copy or something (that didnt work tho), but i can't figure out what the problem is. Does anyone know what the problem is? I know this isnt a great explanation and if its too confusing i could send some snapshots of the program or something. Any help would be greatly appreciated though.
 
Thanks,
Will
0 Kudos
Message 1 of 5
(2,698 Views)

Posting the code or image of it would definitely be helpful, and shift registers would be prefereable over locals, but I guess that the problem here that you're trying to pass an IMAQ reference (which is only a pointer to the data and not the data itself) and that might be the source of the problem since either (guessing here) the IMAQ ref becomes invalid or you're not using the right function to extract the data.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here, here, here and here are a few you can start with and here are some tutorial videos. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(2,691 Views)
So i attached 2 snapshots of the program to give a better idea of the problem. The first snapshot shows an image getting written to the local variable SavedMask. The second snapshot, which is run on the next iteration of a while loop, shows the local variable SavedMask being read to other image operations. When i run the program, the SavedMask image is always displayed correctly on the front panel, but i can't read from it for whatever reason. I think the problem could be like you said, that im only passing an imaq reference, and i think theres a certain way to extract the image data. Do you know the correct way to extract the image data or how to pass the image data and not just a reference to the data.
Download All
0 Kudos
Message 3 of 5
(2,676 Views)

I don't use IMAQ, but basically, the image data would be extracted with the various IMAQ VIs.

If the 2 frames of the case structure are really executing in different iterations of a loop, then I would actually expect this to work, but if the program is stopped then the IMAQ reference would lose its meaning. In any case, a program with sequence structures and locals can be a good recipe for race conditions and problems like this. I would suggest that you try to follow the tutorials and simplify the code and, if that doesn't help, post your code so we can have a better look at it.


___________________
Try to take over the world!
0 Kudos
Message 4 of 5
(2,663 Views)
I figured out the problem, thanks for the help!
0 Kudos
Message 5 of 5
(2,650 Views)