how to calculate the no. of pixel?

2 visualizaciones (últimos 30 días)
mohd akmal masud
mohd akmal masud el 11 de Nov. de 2020
Comentada: mohd akmal masud el 12 de Nov. de 2020
hi all,
i done convert gray image to binary image. but how i want to calculate the how much no pixel in red circle as picture attached??
my image name is spect128x128
I15 = dicomread('spect128x128', 'frame', 15);
T15 = graythresh(level);
BW15 = imbinarize(I15,T15);
figure
imshowpair(I15, BW15, 'montage')

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 11 de Nov. de 2020
See bwconncomp(): https://www.mathworks.com/help/images/ref/bwconncomp.html. It returns a struct. You can check the number of elements in PixelIdxList property to count the pixels.
  5 comentarios
Ameer Hamza
Ameer Hamza el 12 de Nov. de 2020
You can just access it as a cell array
CC.PixelIdxList{4} % 4 indicate 4th element
It will give linear indexes of pixel. To get row and column index, read my answer here: https://www.mathworks.com/matlabcentral/answers/645283-how-to-know-the-location-pixel#answer_542043
mohd akmal masud
mohd akmal masud el 12 de Nov. de 2020
ok, thank you so much sir.
then how to to fill the color in every object. lets say i want fill blue color in object no.4?

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by