i want to load my_images and scribbles mat file in my prgm.but i don't have code.

1 回表示 (過去 30 日間)
shikhar srivastava
shikhar srivastava 2016 年 1 月 26 日
コメント済み: Stephen23 2016 年 1 月 26 日
this is my code in which i want to laod mat file.
load my_images
load scribbles
if this variable is set to 0, only the final alpha matting is saved. Otherwise, partial results (such as the matting components) are saved.
save_partial_results = 0;
% try to group the matting components for forground/background matting
do_grouping = 1;
% for all examples here we use 50 eigen vectors...
eigs_num=50;
if (1)
nclust =10;
[alpha_comps,alpha] = SpectralMatting(my_images.woman, [], 'woman_', eigs_num, nclust, ...
[], save_partial_results);
end
if (1)
nclust =10;
[alpha_comps,alpha] = SpectralMatting(my_images.face, [], 'face_', eigs_num, nclust, ...
[], save_partial_results);
end
if (1)
nclust = 8;
[alpha_comps,alpha] = SpectralMatting(my_images.kim, scribbles.kim, 'kim_', eigs_num, nclust, ...
[], save_partial_results);
end
if (1)
nclust = 40;
apply_final_enhancement = 1;
[alpha_comps,alpha] = SpectralMatting(my_images.wind, scribbles.wind, 'wind_', eigs_num, nclust, ...
apply_final_enhancement, save_partial_results);
end
if (1)
nclust = 20;
[alpha_comps,alpha] = SpectralMatting(my_images.kid, scribbles.kid, 'kid_', eigs_num, nclust, ...
[], save_partial_results);
end
  4 件のコメント
shikhar srivastava
shikhar srivastava 2016 年 1 月 26 日
i want to create mat file name my_images which holds 5 images .so that i can use that .mat in my code.

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

回答 (1 件)

Image Analyst
Image Analyst 2016 年 1 月 26 日
You don't have code? It looks like code to me. Not very robust code, but it is code. Why not use exist() to check if those files exist first:
% Get the full filename, with path prepended.
baseFileName = 'scribbles.mat';
fullFileName = fullfile(pwd, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- didn't find it there. Check the search path for it.
fullFileNameOnSearchPath = baseFileName; % No path this time.
if ~exist(fullFileNameOnSearchPath, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
  2 件のコメント
shikhar srivastava
shikhar srivastava 2016 年 1 月 26 日
in this code u r searching .mat file.but i want code.
Image Analyst
Image Analyst 2016 年 1 月 26 日
編集済み: Image Analyst 2016 年 1 月 26 日
I only search the entire search path if it can't find it in the current folder. And that is code.

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by