LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Timeout & Mem Problem

Hello,

 

i have a bit of trouble with the imaq tools.

 

if i want to read a video from the hd (about 70mb) i get a imaq readframe timeout (and the code worked already - other pc same lv..., and no - i dont have the other pc any more). i have done some research on the net and tried a lot of things (reparing my lv and imaq installation, newly install that, reinstall directx...) but i could not solve that one.

 

the second one: on the other pc, where the code worked, i got a error message while processing the video that told (translated from german to english) "not enough memory to complete this operation".

 

as i use a lot of local variables - and i know i should not use that. but i think, that the only thing large enough to cause such a problem is the array, where i hold the frame data of the video - and that cant be that large cause its only about 500 frames per vid. can someone give me some advice please?

 

thank you a lot

martin

0 Kudos
Message 1 of 8
(3,228 Views)

Hello Martin,

 

 

having taken a quick look at your code, a number of issues comes to my mind:

 

a) you are allocating memory for each single video frame during the loading of the video. Depending on how full and how fragmented your RAM already is, Windows must page lots of information to the swap file. This can cause lags that might already be the cause for your IMAQ timeouts.

 

b) when reading the video frames, you are storing the _uncompressed_ RGB pixel data in a 3D array, which you even copy in in later time. 500 frames of uncompressed U8 grayscale video (640x480) equal roughly 150MB of data. Even if you had the whole three GB of RAM available to an application available, allocating such an array  in one block can fail because of allocated IMAQ buffers already scattered across the address space.

 

c) as you never close the references to the AVI file or the IMAQ image buffers, even if you were able to trim a video once, you would have to completely shut down and restart your application after a few iterations - something that your users will surely not approve of.

 

The only sensible way of designing a video trimmer is to use random access when allowing the user to browse through the frames by reading the relevant frame to display "just in time" when the user selects it with the slider. The same mechanism will then be used to analyse the video: read one frame (or two if you need image-to-image comparison), calculate results, discard the (older) frame, read the next frame, perform analysis, ...

 

Best regards,
Sebastian

 

 

Message 2 of 8
(3,217 Views)

hello sebastian,

 

thank you a lot for the reply. i will try chage the vi as you recommended 🙂

 

thanx a lot

martin

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

hello,

 

i have tried to implement the program as you told me. but i failed (as it seems my labviewknowledge is very little...).

 

i dispose everything that is created with imaq_create when i dont need the images any more. further, i read only frame by frame.

 

the timeout still appeas when avi_read is trying to reading even the first frame of the vid. so i guess i must be doing something completly wrong but i just dont know what?

 

it would be very great if you can give me futher advice. is the disposing ok? and what can cause the timeout?

 

thank you a lot in advance

martin

0 Kudos
Message 4 of 8
(3,185 Views)

hello,

 

i have tried to implement the program as you told me. but i failed (as it seems my labviewknowledge is very little...).

 

i dispose everything that is created with imaq_create when i dont need the images any more. further, i read only frame by frame.

 

the timeout still appeas when avi_read is trying to reading even the first frame of the vid. so i guess i must be doing something completly wrong but i just dont know what?

 

it would be very great if you can give me futher advice. is the disposing ok? and what can cause the timeout?

 

thank you a lot in advance

martin

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

Hello Martin,

 

 

you are correct regarding your LabVIEW knowledge. 🙂

 

You might want to consider visiting the LabVIEW Core 1 course to learn about the concept of the state machine and the general use of shift registers (--> addresses the excessive use of local variables) and the LabVIEW Machine Vision course to see how IMAQ image resources and AVI sequences are handled properly...

 

Having said this, please open the attached AVI reader example, run it point it to read your AVI file. Does it play back correclty with this code? If it does, you should have a starting point for the image resource handling. If this code also fails, then you might want to upload the video somewhere and give me the location, so that NI R&D can have a look at why the AVI Read Frame VI fails...

 

Best regards,

Sebastian 

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

hello sebastian,

 

its the same problem with this http://homepage.univie.ac.at/martin.boecskoer/vidseq6.avi file (and others) with the vi you attached.

 

what could cause the problem??

 

thanx a lot

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

Hello Martin,

 

 

you might want to get yourself another PC or upgrade your computer's memory: I could play back the video that you uploaded just fine with the Read AVI example VI - please see the screenshot.

 

 

 

I also opened the Windows Task Manager to see how much memory LabVIEW allocates during playback: less than 90MB were enough...

 

Best regards,

Sebastian 

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