Problem with structure in image processing
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Efstathios Kontolatis
el 12 de Sept. de 2016
Comentada: Efstathios Kontolatis
el 12 de Sept. de 2016
I have a structure of images and I want to make some processing on them. I put them on a list but when I try to save each one of them(I'm using a for loop to make the processing) the code reads the first element of the structure and then it goes straight to the end without reading the rest. Here's my code
imglist=dir('*.tif'); %list of the .tif images
for i=1,length(imglist)
name=getfield(imglist(i),'name');
A=imread(name);
level(i)=graythresh(A); %level of the threshold for Otsu method
BI=im2bw(A,level(i)); %converts the grayscale image to a binary image
thresh(:,:,i)=BI; %save the thresh image
BIedge=edge(BI,'Canny'); %edge detection with Canny method
imshow(BIedge)
edges_canny(:,:,i)=BIedge;
f=figure;
imshow(BI);
saveas(f,sprintf('thresh8B-3.2_15k_0d5_base_x=0mm_y=0mm_C001H001S000100000%d.tif',i))
f=figure;
imshow(imfill(edges_canny(:,:,i),'holes'));
saveas(f,sprintf('canny8B-3.2_15k_0d5_base_x=0mm_y=0mm_C001H001S000100000%d.tif',i))
end
Anyone for help?
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!