Cannot find an exact (case-sensitive) match for 'getFrame' ?

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

Try
vid = VideoReader(fullfile(b,a);
uigetfile is not certain to put a trailing directory delimiter on the directory returned, so you might have been constructing a path to a file that did not exist.
Actually I tried the program but it did not work and that's the errors:
Error using metaclass
Error: File: app1.mlapp Line: 25 Column: 44
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
Error in appdesigner.internal.service.AppManagementService/isBadNumberOfArguments (line 256)
appMetaData = metaclass(app);
Error in appdesigner.internal.service.AppManagementService/tryCallback (line 340)
if (obj.isBadNumberOfArguments(app, exception))
Error in matlab.apps.AppBase>@(source,event)tryCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event)
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.
Error using metaclass
Error: File: app1.mlapp Line: 25 Column: 44
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
Error in appdesigner.internal.service.AppManagementService/isBadNumberOfArguments (line 256)
appMetaData = metaclass(app);
Error in appdesigner.internal.service.AppManagementService/tryCallback (line 340)
if (obj.isBadNumberOfArguments(app, exception))
Error in matlab.apps.AppBase>@(source,event)tryCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event)
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.
The previous instruction of importing was working
What is the content of line 25 of app1.mlapp ?
vid = VideoReader(fullfile(b,a);
LEKHCHINE Somia
LEKHCHINE Somia el 27 de Jul. de 2019
Editada: LEKHCHINE Somia el 27 de Jul. de 2019
My object is to import video and play it in axes using app desinger, so fisrt I try to test if the import instruction work and I write the following code:
[a, b]= uigetfile({'*.*'});
vid = VideoReader([b a]);
implay(vid);
and it realy show the video but I want to display it into the axes (app designer).
The line
vid = VideoReader(fullfile(b,a);
is missing a )
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.
I did everything I had to do and all the instructions that you told me and the same first error
Cannot find an exact (case-sensitive) match for 'getFrame'
The closest match is: getframe in C:\Program Files\MATLAB\R2018b\toolbox\matlab\graphics\getframe.m
Error in app1/importervideoButtonPushed (line 27)
imshow(getFrame(vid),'Parent',app.UIAxes1);
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
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

It is my first experiance with matlab so please be patient with me
I put exactly your code but there is an error:
Undefined function or variable 'thisFrame'.
Error in app1/importervideoButtonPushed (line 31)
img = imshow(thisFrame, 'Parent', app.UIAxes1);
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.
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

Iniciar sesión para comentar.

Más respuestas (1)

LEKHCHINE Somia
LEKHCHINE Somia el 27 de Jul. de 2019
thank you so much and I hope God protects you
but I just declare this frame as private properties and replace it with app.this frame

1 comentario

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.

Iniciar sesión para comentar.

Categorías

Más información sobre App Building en Centro de ayuda y File Exchange.

Preguntada:

el 26 de Jul. de 2019

Comentada:

el 27 de Jul. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by