09-20-2013 02:54 PM
I was using the Vision Assistant for research, and decided on the Edge Detection strategy.
I adjusted the VA script until I could reliably find the desired edge, and saved the script, it included to consecutive Edge Detection steps.
I exported the functionality to LabVIEW 2013 using the VA LabVIEW export tool.
When I opened a stored video file, and ran the images through the newly exported filter, the process worked, and the images were detected.
However, when I ran this process with files containing thousands of images, LabVIEW would crash indicating that it ran out of memory.
Upon investigation I found a memory leak in the 'Vision Assistant Utilities', in the SubVI named 'IVA EdgeDetect - Create Monochrome Image if needed.vi
(revision 13).
In this SubVI, the utility 'IMAQ Create VI' is used to create the image space for processing.
Unfortunately, the image 'name' input is built with a random number generator.
Every time this SubVI is run, a brand new image space is created.
This would be OK, except that the image space is not deleted when the SubVI ends.
I tried adding a 'delete VI' at the end,l but then the SubVI would not return my image (it was deleted).
So, I removed the random number generator from the SubVI, and passed it a consistent string every time it is run.
This way the exact same Image Space is used every time it is executed.
Since the calling routine has already used the returned image, and is working on the next one before this SubVI is called again, that works for me.
With this change, removing the random number generator, I can run thousands of images through this SubVI over and over without running out of memory.
This one change solved my problem.
FYI,
Jeff
09-23-2013 11:16 AM
Most of the code generated by Vision Assistant will not be optimized in any way. It is meant to provide a quick and dirty means for integrating the script into your LV application.
Instead of the random number thing, what you want to do is use a Functional Global to carry your image reference. Like this...
Case structure inside of While Loop, constant "T" wired to stop, First Run wired to Case, IMAQ create image in True case, shift register of the image reference passed through in the False case. Viola! Reusable Image Reference.
03-01-2014 12:53 PM
03-04-2014 12:42 PM
Dear sir
I successfully did it.
Thank you for replying
It will be better if u help me how to write the data in excel.
I did the coding but it is not working properly.
I hope to hear from you soon
03-04-2014 01:37 PM
Hi Zahkay,
How are you trying to write it to excel? Feel free to upload your new VI, as the version I have doesn't have anything regarding excel.