Finding objects in images

1 次查看(过去 30 天)
I want to find objects with grayscale value <30. Now I am trying to write a table with all objects in excel file, then find and remove the row with a certain column value < 30, but there is always unexpected errors about my code.
T = stats;
excelfilename = 'Picture2.xlsx';
writetable(T,excelfilename,'Sheet',1,'Range','A1');
column=xlsread(excelfilename, 'A:A')
H=length(column)
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." The error refers to H which is shown in a correct number but stopped running the rest code. I also tried 'height' and 'size' of the table to denote H, but none worked. Does anyone know where is the problem in my code? Thank you for your time in advance.

采纳的回答

Image Analyst
Image Analyst 2018-2-24
Maybe try braces T{n,'MeanIntensity'} instead of parentheses.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by