When compiling a standalone application, how can I include the class VideoReader?

2 ビュー (過去 30 日間)
Yifei Wang
Yifei Wang 2018 年 8 月 31 日
コメント済み: OCDER 2018 年 9 月 4 日
VideoReader is a class definition in MATLAB toolbox. The toolbox should be included in MATLAB compiler, but it seems that this class definition is not included. I tried to add the M file into the 'files required', but I was not let to do that. So how can I add the class VideoReader?
  2 件のコメント
OCDER
OCDER 2018 年 8 月 31 日
Can you show the code you are trying to compile for VideoReader? Does it work without error in Matlab? What is the error message that you are getting?
I have no issues compiling functions containing VideoReader via mcc.
Yifei Wang
Yifei Wang 2018 年 9 月 4 日
編集済み: Yifei Wang 2018 年 9 月 4 日
I wrote this code to test the function of VideoReader. It does work in GUIDE without error. I use this 'readFrame' here instead of 'read' as MATLAB recommends. Both work well in MATLAB, but neither is working for compiling. Do you have any idea about this?
function pushbutton1_Callback(hObject, eventdata, handles)
[VideoName,VideoPath,FilterIndex] = uigetfile('*.avi','Open AVI file');
readerobj = VideoReader(VideoName);
frame = 1;
while hasFrame(readerobj)
vidFrame = readFrame(readerobj);
I(:,:,frame,:) = vidFrame;
frame = frame + 1;
end
imshow(squeeze(uint8(I(:,:,1,:))));
set(handles.text2,'String',VideoPath);
whos('I')
guidata(hObject, handles);

サインインしてコメントする。

採用された回答

OCDER
OCDER 2018 年 9 月 4 日
Change this:
readerobj = VideoReader(VideoName);
to this:
readerobj = VideoReader(fullfile(VideoPath, VideoName));
Always provide the full video file path, otherwise the compiled software cannot find the video file. The Matlab working paths are different form those of a compiled application.
  2 件のコメント
Yifei Wang
Yifei Wang 2018 年 9 月 4 日
Thanks for the help! It works! In MATLAB, the path is added so there is no error, and I ignore the problem here. Thank you!
OCDER
OCDER 2018 年 9 月 4 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by