09-16-2011 11:32 AM
Is there a way to store the overlay info in an AVI file without using the merge overlay vi? I would like to have a possibility of being able to play the avi with and without the overlay. It is not a problem to make a vi that would merge the overlay permanently. I would like to have a second option to have both the image and the info stored and if necessary I could massage it to be visible and permanent.
In other words:default - overlay not visible, option - passing through a vi that would turn it on and make permanent. The overlay is different in each frame and the video is created in real time so saving two separate files is not an option.
LV 2009 SP1 XP. Thanks!
Solved! Go to Solution.
09-16-2011 01:14 PM
AVIs don't have the notions of overlays. However, if you're going to write it and play it with NI Vision, I can suggest a solution.
Disclaimer: It's dirty, but it works...
The principle is to extract the overlay and save it as an extra info with each frame of the AVI. When you read the AVI, you retrieve the image without overlay, the overlay attached, and if you wish to view the overlay, copy it to the image you're reading from the AVI file.
The problem is that we don't have a function to extract the overlay in vision. Instead, what you can do is create an empty temporary Image. In the loop where you're writing the AVI, copy the overlay from the image into the empty temp image using IMAQ Copy Overlay (Even if the dest image is empty, it works), then flatten this image to string (including Vision Extra Info), and connect this string to the data input of IMAQ AVI Write Frame.
When you read the frame using IMAQ AVI Read Frame, Unflatten the image that contains the overlay (Data Out), and copy this overlay into the image read from the AVI stream.
Hope that can help.
Christophe
09-16-2011 02:19 PM
Thanks. I was thinking about that too. The only problem is it seems to me that this way I get the double size frame - I am saving it without compression. Am I seeing it right?
09-16-2011 02:28 PM
The second image that you flatten only contains the overlay. Do not copy the entire image. Just the overlay. I tried it and it works.
09-16-2011 04:12 PM
I am just trying to clarify. If I flatten the second image, the flattened string will only contain the overlay not the empty image plus overlay? If that is the case it can work for me just fine.
09-16-2011 05:09 PM
The flatten string will contain an empty image (0 x 0) plus the overlay information of the original image. What I meant if that that flatten string should be much smaller than the image that you're storing in the AVI string.
09-16-2011 07:36 PM
Thanks a lot! I will use that.