Memory leak when using preview on an App axes
Mostrar comentarios más antiguos
I did a simple GUI to display my camera in real time. I'm using global variables because I need to get some data of the frames (from another GUI) in order to process them. The code is the following:
global images;
images.camera = videoinput('winvideo',1);
set(images.camera,'ReturnedColorSpace','rgb');
set(images.camera, 'FramesPerTrigger',1);
set(images.camera, 'TriggerRepeat', Inf);
triggerconfig(images.camera, 'manual');
start(images.camera);
cla(app.axes_livecamera, 'reset');
pause(0.2);
img = zeros(480, 720, 3);
images.hImage = imagesc(img, 'Parent', app.axes_livecamera);
pause(0.2);
images.preview = preview(images.camera, images.hImage); %Here is when memory increases
%images.preview = preview(images.camera); %This way memory does not increase.
However, when I start previewing the camera on an axes (instantiated by images.hImages), the memory start increasing until MATLAB crashes (when it consumes around 9GB of RAM). Even though, when I preview my camera in the default figure of preview (withouth instantiating images.hImage), memory does not increase, so I think it might be a problem of axe's handles. How can I avoid this memory leakeage? I need to show my image in app.axes_livecamera, not in the default figure of preview.
Thanks
2 comentarios
Raphael Kriegl
el 13 de Ag. de 2020
Hey, I have the same issue. Did you resolve this somehow?
Jordi Solé
el 14 de Ag. de 2020
Respuestas (0)
Categorías
Más información sobre Graphics Performance en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!