フィルターのクリア

Problem with structure in image processing

1 回表示 (過去 30 日間)
Efstathios Kontolatis
Efstathios Kontolatis 2016 年 9 月 12 日
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?

採用された回答

Stephen23
Stephen23 2016 年 9 月 12 日
You need to use a colon, not a comma:
for i = 1:numel(imglist)
  1 件のコメント
Efstathios Kontolatis
Efstathios Kontolatis 2016 年 9 月 12 日
That's it thank you very much.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by