Finding objects in images

1 vue (au cours des 30 derniers jours)
Tian Tian
Tian Tian le 24 Fév 2018
Commenté : Tian Tian le 24 Fév 2018
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.

Réponse acceptée

Image Analyst
Image Analyst le 24 Fév 2018
Maybe try braces T{n,'MeanIntensity'} instead of parentheses.
  1 commentaire
Tian Tian
Tian Tian le 24 Fév 2018
Thank you so much! It worked perfectly!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by