Having issue with imwrite. I'm attaching my code and error below.

1 回表示 (過去 30 日間)
Shah Isha Redohy
Shah Isha Redohy 2021 年 7 月 24 日
コメント済み: Walter Roberson 2021 年 7 月 28 日
% Apply normalization to images
nim=minMaxNormalize(oim);
% Save the image according to five fold set in respective tumor folder. After processing the whole dataset, take set1 as testing (testDS1)
%and remainig four sets as traing (trainingDS1). apply similar method for set2, set3, set4, and set5
% Set1
if cvind(i)==1
if imlab==1
outputFileName = fullfile('/Users/ragib/Desktop/Thesis/MatlabCodes/set1/meningioma/', [num2str(i) '.jpg']);
imwrite(nim, outputFileName);
elseif imlab==2
outputFileName = fullfile('/Users/ragib/Desktop/Thesis/MatlabCodes/set1/glioma/', [num2str(i) '.jpg']);
imwrite(nim, outputFileName);
elseif imlab==3
outputFileName = fullfile('/Users/ragib/Desktop/Thesis/MatlabCodes/set1/pituitary/', [num2str(i) '.jpg']);
imwrite(nim, outputFileName);
else
fprintf('No label found');
end
end

採用された回答

Image Analyst
Image Analyst 2021 年 7 月 24 日
My guesses are either that the file is probably open and locked in some other program when you try to blast over it, and so it won't let you.
By the way, what is the value of i? You should not use i as a variable since it's the imaginary variable. Use k or index or something else.
Also, do not use JPG format if you're doing image analysis. Use PNG instead. PNG is lossless compression and is pretty much the de facto standard these days while (the hated) JPG often gives bad compression artifacts. There will be no change to image values in a round trip save/recall using PNG like there will be with JPG.
  7 件のコメント
Shah Isha Redohy
Shah Isha Redohy 2021 年 7 月 25 日
it's working now. Thank your everyone for helping.
Walter Roberson
Walter Roberson 2021 年 7 月 28 日
You marked that you are using R2021a, but line 51 of fullfile() for R2021a cannot generate any error. Line 51 of fullfile for R2021a is
containsCellOrStringInput = false;
Either you are using a third-party fullfile(), or else you are using R2016b, which is a release in which string() datatype was first released but was not yet available in all functions (or you copied fullfile.m from an old release.)

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

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by