error in writing an image to folder
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
I have a code ,in which the image is not writing to a folder
clc;
close all;
pathname ='E:\ebcot\mri'
dirlist = dir( [pathname '*.jpg'] );
pickind='jpg';
f1=fullfile('E:\ebcot\sample25\')
if (exist(f1) == 0)
mkdir (f1);
end
for m2 = 1:length(dirlist)
map = pink(90);
i = imread([pathname, dirlist(m2).name]);
a=i;
singvals=20;
dvalue=double(a);
[u,s,v] = svds(dvalue, singvals);
if isa(a,'uint8')
im = uint8(u * s * transpose(v));
end
if isa(a,'uint16')
im = uint16(u * s * transpose(v));
end
if isa(a,'double')
im = (u * s * transpose(v));
end
return;
pickind='jpg'
strtemp=strcat('E:\ebcot\sample25\',int2str(m2),'.',pickind);
imwrite(im,strtemp);%title('ebcot low pass frames ');
end
I have 15 jpg images in mri folder,please help
0 件のコメント
回答 (1 件)
Image Analyst
2012 年 2 月 21 日
I think the "return" statement right before the imwrite() might be a huge factor in why it never gets to the imwrite().
By the way, use it like this to check the folder:
f1='E:\ebcot\sample25\'; % No need for fullfile() here.
if ~exist(f1, 'dir')
mkdir (f1);
end
Don't assign anything to i, which is the imaginary variable, because you'll override it. It's generally not recommended.
You might use fullfile() instead of this "[pathname, dirlist(m2).name]" or the strcat(). You can also use sprintf() instead of strcat, or simply square brackets.
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!