MATLAB Answers

Out of memory while taking frames

20 views (last 30 days)
Claudia Scarpellini
Claudia Scarpellini on 28 Feb 2021
Answered: Shadaab Siddiqie on 3 Mar 2021
I'm writing a program for a project that is becoming more and more complex. Among the others, it calls a function to take pictures (using the webcam package), performs some data extraction from it and then returns this data. This operation involves the communication with 2 devices (an IR camera and a 3d printer) and takes tipically 0.08 seconds. However, in my program this operation must be repeated for a lot of iterations (sometimes it can be 2000) and the program has many different cycles involving this process. I once got a "out of memory" warning in matlab command window with a general consistent slowering of this function (up to 6 s!!!).
function Result_Imaging = AcquisitionIR(IR_cam,Pixels)
frameIR = snapshot(IR_cam);
%My Computation
Result_Imaging = struct%....
end
Is it possible that the pictures I'm taking remain saved in memory even if I'm taking them in a function, performing some calculations and not saving them? I tried adding a
clearvars -except Result_Imaging
at the end of the function but for, for example 100 frames, doesn't make a lot of difference.
The RAM is 16 GB.

Answers (1)

Shadaab Siddiqie
Shadaab Siddiqie on 3 Mar 2021
From my understanding you are getting an out of memory error in your project. Here is a resource which might help you to self resolve the issue.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!