Save image in specific location (directory)

2 ビュー (過去 30 日間)
Bill White
Bill White 2024 年 1 月 29 日
コメント済み: Bill White 2024 年 1 月 29 日
I am loading a video file, then saving indivdual frames as jpg images.
I ask the user of the script to locate and open the video file:
% Ask user to open video file
[baseFileName, folderName, FilterIndex] = uigetfile('*.*', 'Select Video File');
if ~isequal(baseFileName, 0)
movieFullFileName = fullfile(folderName, baseFileName);
else
return;
end
Once matlab does its thing, I want to be able to write an image to the same directory as the video file came from.
imwrite(frame,"frame.jpg") % + something to write in the proper place
Is this possible?

採用された回答

Voss
Voss 2024 年 1 月 29 日
Specify the full path to write to:
imwrite(frame,fullfile(folderName,"frame.jpg"))
Of couse, if that line is located in a different function than the function that defines folderName (i.e., the function where uigetfile is called), then you'll need to store folderName as an app property (App Designer) or in the handles structure (GUIDE) or otherwise make folderName accessible where you need it.
  7 件のコメント
Voss
Voss 2024 年 1 月 29 日
You're welcome!
On second thought, exportgraphics might be more like what you're after.
Bill White
Bill White 2024 年 1 月 29 日
thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by