Error using VideoReader/init (line 607) The filename specified was not found in the MATLAB path. Any ideas how to fix that error?

조회 수: 6 (최근 30일)
Error using VideoReader/init (line 607) The filename specified was not found in the MATLAB path.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 9월 26일
You passed in a file name that is not the name of any file in your current directory or any directory on the path. In other words, you asked it to read a non-existing file.
  댓글 수: 4
abbxucy11
abbxucy11 2016년 9월 27일
video =[handles.FilePath handles.FileName];
axes(handles.axesRoiVideo);
%create a matrix to save the array of croped images
img = frame2im(VideoReader(video,1))
I ran the code with breakpoints and it's okay , the video variable is recognized by the first command but there's an error at the command VideoReader
Walter Roberson
Walter Roberson 2016년 9월 27일
편집: Walter Roberson 2016년 9월 27일
%when you use uigetfile(), the path that is returned might not end in a folder separator. Use fullfile() to be safe.
filename = fullfile(handles.FilePath, handles.FileName);
if ~exist(filename, 'file')
error('Video file "%s" does not exist', filename);
end
try
videoobj = VideoReader(filename);
catch
error('File "%s" cannot be read as a video', filename);
end
img = readFrame(videoobj); %no frame2im !
If you have an old enough version of MATLAB then you will instead need
img = read(videoobj, 1); %no frame2im

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by