Filter löschen
Filter löschen

How to count each colour pixel of an image?

2 Ansichten (letzte 30 Tage)
muhaimin mahfudz
muhaimin mahfudz am 30 Sep. 2018
Kommentiert: Image Analyst am 2 Okt. 2018
I am trying to quantify the value of of each matter of the brain using matlab. I have segmented the image and result as shown below.
  2 Kommentare
Akira Agata
Akira Agata am 30 Sep. 2018
Bearbeitet: Akira Agata am 30 Sep. 2018

Is it a result of k-means clustering? If so, you can count each color pixel easily by using the output variable of kmeans function.

muhaimin mahfudz
muhaimin mahfudz am 1 Okt. 2018
Bearbeitet: muhaimin mahfudz am 1 Okt. 2018
yes it is. I see, in conclusion i can just obtain the values from there as it is the value of each segmented color?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 30 Sep. 2018

Take the histogram of your segmented/classified image

counts = imhist(classifiedImage);

Each class will have a certain value, like gray matter is 1, background is 0, white material is 2, etc. imhist() simply counts the pixels in each class.

  3 Kommentare
Image Analyst
Image Analyst am 1 Okt. 2018
imhist() will do it. You pass in the classified image, not an RGB image, but the image you got from kmeans. See attached demo.
Image Analyst
Image Analyst am 2 Okt. 2018
Do you still not understand? If so, give me the script you used to create that image along with the original image.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by