Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
error in writing an image to folder
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Image Analyst
el 21 de Feb. de 2012
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.
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!