Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ AVI2 Write Frame Issue

Solved!
Go to solution

Hi,

 

If I had to guess, you might be skipping frames during the acquisition and this would cause your frame rate during playback to appear faster. If you post your code it might be easier to spot the problem.

0 Kudos
Message 11 of 15
(2,569 Views)
I'll post it tonight when I get home. thanks for all your help, it is greatly appreciated!
0 Kudos
Message 12 of 15
(2,568 Views)

Attached is a zip file of the software I am working on. Sorry it might be a little messy, but it should be readable.  

 

After thinking about it tonight, I know exactly what is going on. The images are actually references to the image buffer. I was treating them like the were image data and not references. Since the program uses a producer-consumer pattern, the program wasn't writing every image to the avi file, but rather whatever reference was available at the time. This was creating the jitter because I was only putting some frames into the AVI file. 

 

At one point I even tried waiting until I "acquired" all the images by running the save to disk loop last. Of course, I only ended up with the last image for the entire duratoin of the AVI movie. 

 

Once I realized this, then I created 500 buffers to extract the image from. This helped, but it still isn't quite right. I imagine that the buffers get filled with new references before my consumer loops can consume them all. The bottleneck is the amount of time that the IMAQ AVI2 Write Frame.vi takes to write the frame to the file. While it is saving the image reference is getting written over. 

 

Also, this is what is causing the last image to be written to the AVI file for the majority of the movie. 

 

Am I going to be able to write every frame to disk during a live acquisition? Or will I have to do something like save the data to a binary file and convert the binary file data to AVI after acquisition?

0 Kudos
Message 13 of 15
(2,554 Views)

Here is a link to the video I referenced in my last post: https://youtu.be/VzavEuHGWS8

0 Kudos
Message 14 of 15
(2,552 Views)
I think I need to get the image data out of the IMAQ buffer in order to successfully process it. I've thought of a few strategies to get around this issue. they are:

1. Use the IMAQ ImageToArray.vi to get the pixel data. this way the buffer is freed up to accept new images and the pixel data could be converted back into an image before saving to the avi.

2. Use the IMAQ Copy Acquired Buffer.vi to make a copy of the buffer to be processed by my consumer loops while the original buffer gets overwritten with a new image.

3. Use more buffers so that I guarantee that I have enough buffer that the images get processed before they are overwritten.

can you give me some feedback about which of these three I pursue before I dig into them? they all seem like they will be memory hogs.
0 Kudos
Message 15 of 15
(2,533 Views)