Finding objects in images

1 visualización (últimos 30 días)
Tian Tian
Tian Tian el 24 de Feb. de 2018
Comentada: Tian Tian el 24 de Feb. de 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.

Respuesta aceptada

Image Analyst
Image Analyst el 24 de Feb. de 2018
Maybe try braces T{n,'MeanIntensity'} instead of parentheses.
  1 comentario
Tian Tian
Tian Tian el 24 de Feb. de 2018
Thank you so much! It worked perfectly!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by