Cannot find an exact (case-sensitive) match for 'getFrame' ?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
LEKHCHINE Somia
el 26 de Jul. de 2019
Comentada: Walter Roberson
el 27 de Jul. de 2019
I use matlab R2018b and Iwant to display a video in axes using app designer this is my code:
function importervideoButtonPushed(app, event)
% to import some thing
[a, b]= uigetfile({'*.*'});
vid = VideoReader([b a]);
while hasFrame(vid)
imshow(getFrame(vid), 'Parent', app.UIAxes1);
end
end
but when I push on the button the following error is written
what should I do ?
8 comentarios
Walter Roberson
el 27 de Jul. de 2019
Remember to put in a drawnow() after the imshow()
Also, imshow() is a fairly expensive operation. It is better (faster) to create a image() object and set the the CData property of the object.
Respuesta aceptada
Walter Roberson
el 27 de Jul. de 2019
Editada: Walter Roberson
el 27 de Jul. de 2019
function importervideoButtonPushed(app, event)
% to import some thing
[a, b]= uigetfile({'*.*'});
vid = VideoReader([b a]);
first = true;
while hasFrame(vid)
thisframe = readFrame(vid);
if first
img = imshow(thisFrame, 'Parent', app.UIAxes1);
first = false;
else
img.CData = thisframe;
end
drawnow();
end
end
2 comentarios
Walter Roberson
el 27 de Jul. de 2019
function importervideoButtonPushed(app, event)
% to import some thing
[a, b]= uigetfile({'*.*'});
vid = VideoReader([b a]);
first = true;
while hasFrame(vid)
thisframe = readFrame(vid);
if first
img = imshow(thisframe, 'Parent', app.UIAxes1);
first = false;
else
img.CData = thisframe;
end
drawnow();
end
end
Más respuestas (1)
LEKHCHINE Somia
el 27 de Jul. de 2019
1 comentario
Walter Roberson
el 27 de Jul. de 2019
I guess you could do that, but it should not be needed, not unless you want to access the last frame of the video after the video is played.
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!