필터 지우기
필터 지우기

Problem with structure in image processing

조회 수: 1 (최근 30일)
Efstathios Kontolatis
Efstathios Kontolatis 2016년 9월 12일
댓글: 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)

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by