필터 지우기
필터 지우기

How to make a loop on objects after watershed segmentation

조회 수: 2 (최근 30일)
Tian Tian
Tian Tian 2018년 2월 23일
댓글: Matt J 2018년 2월 23일
I want to find objects with mean grayscale value <30 after watershed segmentation. But I don't know how to write the loop.After watershed, I think it is the segmented image is in label matrix (but not exactly sure). Could anyone give me a hand on writing this loop? Any help is appreciated.

채택된 답변

Matt J
Matt J 2018년 2월 23일
편집: Matt J 2018년 2월 23일
No need for a loop,
stats=regionprops(labelmatrix, grayvalues, 'MeanIntensity');
index=[stats.MeanIntensity]<30;
  댓글 수: 6
Tian Tian
Tian Tian 2018년 2월 23일
편집: Matt J 2018년 2월 23일
Thank you for this loop. I am trying this, but there is always unexpected errors about my code. If it is possible, may you please have a look?
T = stats;
excelfilename = 'Picture2.xlsx';
writetable(T,excelfilename,'Sheet',1,'Range','A1');
column=xlsread(excelfilename, 'A:A')
H=length(column)
dbstop if error
for n = 1 : H
MeanIntensity(n)= T(n,'MeanIntensity')
if (MeanIntensity(n)<30)
% Intensity is < 30
mask = ismember(cc, n);
outputImage = I;
outputImage(~mask) = 0;
figure; % Bring up new figure
imshow(outputImage , []);
end
end
The error is "You cannot subscript a table using linear indexing (one subscript) or multidimensional indexing (three or more subscripts). Use a row subscript and a variable subscript." Thank you for your time in advance.
Matt J
Matt J 2018년 2월 23일
@Tian Tian,
Please close this question (by Accept-clicking) and start a new one. The issue in your posted question has been addressed. The discussion is now well into other unrelated issues.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by